changeset 15297:befefbf0670f

* gnus.el (gnus-article-date-ut): Avoid race condition.
author Karl Heuer <kwzh@gnu.org>
date Tue, 28 May 1996 15:42:20 +0000
parents b77f65304dd9
children 7c0be13394a1
files lisp/gnus.el
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus.el	Tue May 28 15:22:05 1996 +0000
+++ b/lisp/gnus.el	Tue May 28 15:42:20 1996 +0000
@@ -11287,12 +11287,16 @@
 	    ((eq type 'lapsed)
 	     ;; If the date is seriously mangled, the timezone
 	     ;; functions are liable to bug out, so we condition-case
-	     ;; the entire thing.  
-	     (let* ((real-sec (condition-case ()
+	     ;; the entire thing.  We call (current-time) once, rather than
+	     ;; letting current-time-string and current-time-zone default to
+	     ;; it, because that avoids a rare race condition when the time
+	     ;; zone changes between those two calls.
+	     (let* ((now (current-time))
+		    (real-sec (condition-case ()
 				  (- (gnus-seconds-since-epoch 
 				      (timezone-make-date-arpa-standard
-				       (current-time-string) 
-				       (current-time-zone) "UT"))
+				       (current-time-string now) 
+				       (current-time-zone now) "UT"))
 				     (gnus-seconds-since-epoch 
 				      (timezone-make-date-arpa-standard 
 				       date nil "UT")))