Commit 0d26feea authored by Karl Heuer's avatar Karl Heuer
Browse files

(appt-check, appt-make-list): Avoid race condition

by getting current time once, not twice.
parent 3fbe4759
...@@ -246,10 +246,9 @@ Therefore, you need to have `(display-time)' in your .emacs file." ...@@ -246,10 +246,9 @@ Therefore, you need to have `(display-time)' in your .emacs file."
;; Get the current time and convert it to minutes ;; Get the current time and convert it to minutes
;; from midnight. ie. 12:01am = 1, midnight = 0. ;; from midnight. ie. 12:01am = 1, midnight = 0.
(let* ((cur-hour(string-to-int (let* ((now (decode-time))
(substring (current-time-string) 11 13))) (cur-hour (nth 2 now))
(cur-min (string-to-int (cur-min (nth 1 now))
(substring (current-time-string) 14 16)))
(cur-comp-time (+ (* cur-hour 60) cur-min))) (cur-comp-time (+ (* cur-hour 60) cur-min)))
;; At the first check after 12:01am, we should update our ;; 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." ...@@ -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 ;; that are earlier than the present time can
;; be removed. ;; be removed.
(let* ((cur-hour(string-to-int (let* ((now (decode-time))
(substring (current-time-string) 11 13))) (cur-hour (nth 2 now))
(cur-min (string-to-int (cur-min (nth 1 now))
(substring (current-time-string) 14 16)))
(cur-comp-time (+ (* cur-hour 60) cur-min)) (cur-comp-time (+ (* cur-hour 60) cur-min))
(appt-comp-time (car (car (car appt-time-msg-list))))) (appt-comp-time (car (car (car appt-time-msg-list)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment