summaryrefslogtreecommitdiff
path: root/lisp/gnus.el
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1996-05-28 15:42:20 +0000
committerKarl Heuer <kwzh@gnu.org>1996-05-28 15:42:20 +0000
commit96d50ecc6fd0c53f986ce4309b0383c34f1a44e7 (patch)
treeacb1ba2604c2d055d9160e82088f2795c88ea52b /lisp/gnus.el
parentfeeb890e99e1435f3d312e1eff872b346249d42b (diff)
downloademacs-96d50ecc6fd0c53f986ce4309b0383c34f1a44e7.tar.gz
* gnus.el (gnus-article-date-ut): Avoid race condition.
Diffstat (limited to 'lisp/gnus.el')
-rw-r--r--lisp/gnus.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/lisp/gnus.el b/lisp/gnus.el
index 8086864db4a..74a6ed20a18 100644
--- a/lisp/gnus.el
+++ b/lisp/gnus.el
@@ -11287,12 +11287,16 @@ how much time has lapsed since DATE."
((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")))