# HG changeset patch # User Karl Heuer # Date 837462192 0 # Node ID 4942f03c75f8d6d50ecebf57d024a15131c011d3 # Parent 7a25ca1a7d7decdd034d6e6edd0f69df7671af36 (appt-check, appt-make-list): Avoid race condition by getting current time once, not twice. diff -r 7a25ca1a7d7d -r 4942f03c75f8 lisp/calendar/appt.el --- 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)))))