summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/time-stamp.el12
-rw-r--r--lisp/time.el33
-rw-r--r--lisp/vc/add-log.el23
-rw-r--r--lisp/vc/log-edit.el3
4 files changed, 24 insertions, 47 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 24e5ef47d29..1e0fe9919d2 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -420,16 +420,8 @@ format the string."
(or ts-format
(setq ts-format time-stamp-format))
(if (stringp ts-format)
- (if (stringp time-stamp-time-zone)
- (let ((ts-real-time-zone (getenv "TZ")))
- (unwind-protect
- (progn
- (setenv "TZ" time-stamp-time-zone)
- (format-time-string
- (time-stamp-string-preprocess ts-format)))
- (setenv "TZ" ts-real-time-zone)))
- (format-time-string
- (time-stamp-string-preprocess ts-format)))
+ (format-time-string (time-stamp-string-preprocess ts-format)
+ nil time-stamp-time-zone)
;; handle version 1 compatibility
(cond ((or (eq time-stamp-old-format-warn 'error)
(and (eq time-stamp-old-format-warn 'ask)
diff --git a/lisp/time.el b/lisp/time.el
index ae0e598b64c..d35f5b93964 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -160,15 +160,8 @@ LABEL is a string to display as the label of that TIMEZONE's time."
(defcustom display-time-world-list
;; Determine if zoneinfo style timezones are supported by testing that
;; America/New York and Europe/London return different timezones.
- (let ((old-tz (getenv "TZ"))
- gmt nyt)
- (unwind-protect
- (progn
- (setenv "TZ" "America/New_York")
- (setq nyt (format-time-string "%z"))
- (setenv "TZ" "Europe/London")
- (setq gmt (format-time-string "%z")))
- (setenv "TZ" old-tz))
+ (let ((nyt (format-time-string "%z" nil "America/New_York"))
+ (gmt (format-time-string "%z" nil "Europe/London")))
(if (string-equal nyt gmt)
legacy-style-world-list
zoneinfo-style-world-list))
@@ -523,21 +516,19 @@ See `display-time-world'."
"Replace current buffer text with times in various zones, based on ALIST."
(let ((inhibit-read-only t)
(buffer-undo-list t)
- (old-tz (getenv "TZ"))
+ (now (current-time))
(max-width 0)
result fmt)
(erase-buffer)
- (unwind-protect
- (dolist (zone alist)
- (let* ((label (cadr zone))
- (width (string-width label)))
- (setenv "TZ" (car zone))
- (push (cons label
- (format-time-string display-time-world-time-format))
- result)
- (when (> width max-width)
- (setq max-width width))))
- (setenv "TZ" old-tz))
+ (dolist (zone alist)
+ (let* ((label (cadr zone))
+ (width (string-width label)))
+ (push (cons label
+ (format-time-string display-time-world-time-format
+ now (car zone)))
+ result)
+ (when (> width max-width)
+ (setq max-width width))))
(setq fmt (concat "%-" (int-to-string max-width) "s %s\n"))
(dolist (timedata (nreverse result))
(insert (format fmt (car timedata) (cdr timedata))))
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index eb7e5bfdfad..c90413c42c2 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -581,8 +581,8 @@ If t, use universal time.")
(put 'add-log-time-zone-rule 'safe-local-variable
(lambda (x) (or (booleanp x) (stringp x))))
-(defun add-log-iso8601-time-zone (&optional time)
- (let* ((utc-offset (or (car (current-time-zone time)) 0))
+(defun add-log-iso8601-time-zone (&optional time zone)
+ (let* ((utc-offset (or (car (current-time-zone time zone)) 0))
(sign (if (< utc-offset 0) ?- ?+))
(sec (abs utc-offset))
(ss (% sec 60))
@@ -596,12 +596,11 @@ If t, use universal time.")
(defvar add-log-iso8601-with-time-zone nil)
-(defun add-log-iso8601-time-string ()
- (let ((time (format-time-string "%Y-%m-%d"
- nil (eq t add-log-time-zone-rule))))
+(defun add-log-iso8601-time-string (&optional time zone)
+ (let ((date (format-time-string "%Y-%m-%d" time zone)))
(if add-log-iso8601-with-time-zone
- (concat time " " (add-log-iso8601-time-zone))
- time)))
+ (concat date " " (add-log-iso8601-time-zone time zone))
+ date)))
(defun change-log-name ()
"Return (system-dependent) default name for a change log file."
@@ -848,14 +847,8 @@ non-nil, otherwise in local time."
(let ((new-entries
(mapcar (lambda (addr)
(concat
- (if (stringp add-log-time-zone-rule)
- (let ((tz (getenv "TZ")))
- (unwind-protect
- (progn
- (setenv "TZ" add-log-time-zone-rule)
- (funcall add-log-time-format))
- (setenv "TZ" tz)))
- (funcall add-log-time-format))
+ (funcall add-log-time-format
+ nil add-log-time-zone-rule)
" " full-name
" <" addr ">"))
(if (consp mailing-address)
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index d59549772c0..acbd9c0cd9f 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -872,7 +872,8 @@ Return non-nil if it is."
(and (boundp 'user-mail-address) user-mail-address)))
(time (or (and (boundp 'add-log-time-format)
(functionp add-log-time-format)
- (funcall add-log-time-format))
+ (funcall add-log-time-format
+ nil add-log-time-zone-rule))
(format-time-string "%Y-%m-%d"))))
(if (null log-edit-changelog-use-first)
(looking-at (regexp-quote (format "%s %s <%s>" time name mail)))