summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-07-15 20:23:12 +0000
committerKarl Heuer <kwzh@gnu.org>1996-07-15 20:23:12 +0000
commit480e87acecc142b05a1c0d1ae1eb289148e43b7d (patch)
treee33b4a101df4c56c0c33d03a2ddafc4d10a0822a
parent0f7112de5bb371c9b4a75963b6cea71a53840240 (diff)
downloademacs-480e87acecc142b05a1c0d1ae1eb289148e43b7d.tar.gz
(appt-check, appt-make-list): Avoid race condition
by getting current time once, not twice.
-rw-r--r--lisp/calendar/appt.el14
1 files changed, 6 insertions, 8 deletions
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index a47cacf53f6..e5fe7d05428 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -246,10 +246,9 @@ Therefore, you need to have `(display-time)' in your .emacs file."
;; 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 @@ The time should be in either 24 hour format or am/pm format."
;; 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)))))