Mercurial > emacs
changeset 15679:4942f03c75f8
(appt-check, appt-make-list): Avoid race condition
by getting current time once, not twice.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Mon, 15 Jul 1996 20:23:12 +0000 |
parents | 7a25ca1a7d7d |
children | 0f1c12e35879 |
files | lisp/calendar/appt.el |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/calendar/appt.el Mon Jul 15 20:18:18 1996 +0000 +++ b/lisp/calendar/appt.el Mon Jul 15 20:23:12 1996 +0000 @@ -246,10 +246,9 @@ ;; Get the current time and convert it to minutes ;; from midnight. ie. 12:01am = 1, midnight = 0. - (let* ((cur-hour(string-to-int - (substring (current-time-string) 11 13))) - (cur-min (string-to-int - (substring (current-time-string) 14 16))) + (let* ((now (decode-time)) + (cur-hour (nth 2 now)) + (cur-min (nth 1 now)) (cur-comp-time (+ (* cur-hour 60) cur-min))) ;; At the first check after 12:01am, we should update our @@ -530,10 +529,9 @@ ;; that are earlier than the present time can ;; be removed. - (let* ((cur-hour(string-to-int - (substring (current-time-string) 11 13))) - (cur-min (string-to-int - (substring (current-time-string) 14 16))) + (let* ((now (decode-time)) + (cur-hour (nth 2 now)) + (cur-min (nth 1 now)) (cur-comp-time (+ (* cur-hour 60) cur-min)) (appt-comp-time (car (car (car appt-time-msg-list)))))