diff options
author | Stephen Gildea <stepheng+emacs@gildea.com> | 2019-11-06 08:31:48 -0800 |
---|---|---|
committer | Stephen Gildea <stepheng+emacs@gildea.com> | 2019-11-06 08:33:51 -0800 |
commit | 9ce67baa9a3733ae93885b6242130497b13c8703 (patch) | |
tree | 8041bf428f56c53d6a2c2dfd62c6585370be6866 /lisp/time-stamp.el | |
parent | da2df1c1b5b5a7373f361875b43dd003a221e2e0 (diff) | |
download | emacs-9ce67baa9a3733ae93885b6242130497b13c8703.tar.gz |
time-stamp: add support for time zone numeric offset
* time-stamp.el: Implement %:z as expanding to the numeric time zone
offset, to address the feature request of bug#32931. Do not document it
yet, to discourage compatibility problems in mixed Emacs 26 and Emacs 27
environments. Documentation will be added in a subsequent release at
least two years later. (We cannot yet use %z for numeric time zone
because in Emacs 26 it was documented to do something else.)
* time-stamp-tests.el (time-stamp-test-format-time-zone): expand this
test and break it into two tests, time-stamp-test-format-time-zone-name
and time-stamp-test-format-time-zone-offset.
Diffstat (limited to 'lisp/time-stamp.el')
-rw-r--r-- | lisp/time-stamp.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el index 6b1ff3e618c..55892cdb83c 100644 --- a/lisp/time-stamp.el +++ b/lisp/time-stamp.el @@ -570,11 +570,13 @@ and all `time-stamp-format' compatibility." (string-to-number (time-stamp--format "%Y" time))))) ((eq cur-char ?Y) ;4-digit year (string-to-number (time-stamp--format "%Y" time))) - ((eq cur-char ?z) ;time zone lower case + ((eq cur-char ?z) ;time zone offset (if change-case "" ;discourage %z variations - (time-stamp--format "%#Z" time))) - ((eq cur-char ?Z) + (if alt-form + (time-stamp--format "%z" time) + (time-stamp--format "%#Z" time)))) ;backward compat, will change + ((eq cur-char ?Z) ;time zone name (if change-case (time-stamp--format "%#Z" time) (time-stamp--format "%Z" time))) |