obsoleting two time zone abbreviation variables
Paul Eggert <[email protected]>
| Newsgroups | gmane.emacs.devel |
|---|---|
| Organization | UCLA Computer Science Department |
| Message-ID | <[email protected]> |
The recent changes to timekeeping in Alberta, on top of the changes to British Columbia, will cause even more confusion about time zone abbreviations. For example, in Alberta it's not clear whether "MST" will mean -07 (longstanding historical practice) or -06 (new permanent UT offset in Alberta). This boosts the priority of being cautious about these abbreviations, so I installed the attached change to Emacs master in the form of a series of patches. The main effect, other than documentation, is to use make-obsolete-variable to mark the variables 'math-tzone-names' and 'timezone-world-timezones' as obsolete, as their default values are now problematic even in parts of North America. Formerly their obsolescence was documented only in the doc strings and manual. Comments welcome as usual.
emacs-tz.diff
(text/x-patch, 7.5 KB)
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 4032279993d..4c2563748dd 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1547,6 +1547,8 @@ Time Zone Rules
second element, @var{abbr}, is a string giving a possibly-ambiguous
abbreviation for the time zone, e.g., @samp{"IST"} for India Standard
Time, Irish Standard Time, or Israel Standard Time.
+POSIX-compatible time zone abbreviations are three to six characters
+that are each an ASCII alphanumeric, @samp{+}, or @samp{-}.
Both elements can change when daylight
saving time begins or ends; if the user has specified a time zone that
does not use a seasonal time adjustment, then the value is constant
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 636b024d50c..a032d4e7078 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -17371,7 +17371,7 @@ Time Zones
(for Japan standard and Greenwich mean time, respectively).
North American and European time zone names are defined as follows.
-These names are obsolescent and new code should not rely on them:
+These names are obsolete and new code should not rely on them:
the @samp{YST}-related names have disagreed with time in Yukon since 1973,
the @samp{PST}- and @samp{MST-}related names have disagreed with
time in western Canada since 2026,
@@ -17394,21 +17394,6 @@ Time Zones
@end group
@end smallexample
-@vindex math-tzone-names
-To define time zone names that do not appear in the above table,
-you must modify the Lisp variable @code{math-tzone-names}. This
-is a list of lists describing the different time zone names; its
-structure is best explained by an example. The three entries for
-circa-2026 time in Sydney, Australia might look like this:
-
-@smallexample
-@group
-(("AEST" -10 0) ; Name as an upper-case string, then standard
- ("AEDT" -10 -1) ; adjustment, then daylight saving adjustment.
- ("AEGT" -10 "AEST" "AEDT")) ; Generalized time zone.
-@end group
-@end smallexample
-
@cindex @code{TimeZone} variable
@vindex TimeZone
With no arguments, @code{calc-time-zone} or @samp{tzone()} will by
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index fa436e0b87d..c8e2feb2f28 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -18335,12 +18335,12 @@ Diary Messages
mean ``all possible values'', but ``use only the other field''. Note
that if both are star'ed, the use of either one gives the same result.
@item
-The @code{Time-Zone} header is special in that it can only have one
+The @code{Time-Zone} header is special in that it can have only one
value (@code{GMT}, for instance). A star doesn't mean ``all possible
values'' (because it makes no sense), but ``the current local time
zone''. Most of the time, you'll be using a star here. However, for a
-list of available time zone values, see the variable
-@code{nndiary-headers}.
+Universal Time entry, you can use @code{GMT}, @code{UT}, @code{UTC} or
+@code{Z}.
@end itemize
As a concrete example, here are the diary headers to add to your message
diff --git a/etc/NEWS b/etc/NEWS
index ff4f2ee739b..62cd3e758ef 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -473,6 +473,12 @@ When a test fails, the erts-file tests buffer displayed by
button labeled "diff". Pushing it displays a Diff Mode buffer comparing
the actual and expected output.
++++
+** The variables 'math-tzone-names' and 'timezone-world-timezones' are
+now marked obsolete. Strings should use numeric abbreviations like
+"-0600" instead of alphabetic abbreviations like "CST", which are too
+often ambiguous.
+
* Changes in Emacs 32.1 on Non-Free Operating Systems
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index d6ff7e953f5..ef224eca596 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -1474,10 +1474,20 @@ math-tzone-names
( "PGT" 8 "PST" "PDT" ) ( "PST" 8 0 ) ( "PDT" 8 -1 ) ; Pacific
( "YGT" 9 "YST" "YDT" ) ( "YST" 9 0 ) ( "YDT" 9 -1 ) ; Yukon
)
- "No doc yet. See calc manual for now.
-This variable is obsolete and new software should not rely on its
-contents. Its abbreviations like \"PST\" have their circa 1970 meanings
-even if timekeeping has changed since then.")
+ "List of lists describing the different time zone names.
+For example, the sublists for circa-1970 time in New York look like this:
+
+ (\"EST\" 5 0) ; Abbreviation, then standard adjustment,
+ (\"EDT\" 5 -1) ; then daylight saving adjustment.
+ (\"EGT\" 5 \"EST\" \"EDT\")) ; Generalized time zone.
+
+This variable's default value contains abbreviations like \"PST\" that
+have their circa 1970 meanings even if timekeeping has changed since then.")
+(make-obsolete-variable
+ 'math-tzone-names
+ "new software should use numeric abbreviations like \"-0500\"
+instead of relying on this variable's contents."
+ "32.1")
(defvar var-TimeZone nil)
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 16eab83433d..e11ab20480d 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -98,8 +98,9 @@ parse-time-zoneinfo
"List of some RFC 822 (or later) alphabetic time zones.
Each entry is in the form (ABBR UTC-OFFSET DAYLIGHT-SAVING-TIME-P).
-As specified in the RFCs, a time zone abbreviation like \"PST\" retains
-its circa 1970 meaning even if legislation changes Pacific time.")
+RFC 2822 (or later) says that the ABBRs are obsolete, and an ABBR like
+\"PST\" retains its circa 1970 meaning even if legislation changes
+Pacific time.")
(defvar parse-time-rules
`(((6) parse-time-weekdays)
@@ -167,8 +168,8 @@ parse-time-string
last two members of the returned value. This function simply
parses the textual representation of date and time into separate
numerical values, and doesn't care whether the time is local or UTC.
-Also, alphabetic time zone abbreviations like \"PST\" have their
-circa 1970 meanings, even if current usage differs.
+Also, obsolete alphabetic time zone abbreviations like \"PST\" have
+their circa 1970 meanings, even if current usage differs.
See `decode-time' for the meaning of FORM."
(condition-case ()
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 8c7f815652f..ac10718a23a 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1201,7 +1201,7 @@ nndiary-parse-schedule
;; Parse the cron-like value of header X-Diary-HEAD in current buffer.
;; - Returns nil if `*'
;; - Otherwise returns a list of integers and/or ranges (BEG . END)
- ;; The exception is the Timze-Zone value which is always of the form (STR).
+ ;; The exception is the Time-Zone value which is always of the form (STR).
;; Signals are caught by `nndiary-schedule'.
(let ((header (format "^X-Diary-%s: \\(.*\\)$" head)))
(goto-char (point-min))
diff --git a/lisp/timezone.el b/lisp/timezone.el
index 643e974ece0..ef8cbf253fc 100644
--- a/lisp/timezone.el
+++ b/lisp/timezone.el
@@ -51,9 +51,12 @@ timezone-world-timezones
("GMT-7" . -700) ("GMT-8" . -800) ("GMT-9" . -900)
("GMT-10" . -1000) ("GMT-11" . -1100) ("GMT-12" . -1200))
"Time differentials of timezone from GMT in +-HHMM form.
-This list is obsolescent, and is present only for backwards compatibility,
+This list is obsolete, and is present only for backwards compatibility,
because time zone names are ambiguous in practice; for example, abbreviations
-like \"PST\" can change meaning with time. Use `current-time-zone' instead.")
+like \"PST\" can change meaning with time.")
+(make-obsolete-variable
+ 'timezone-world-timezones
+ "use numeric time zone abbreviations or `current-time-zone' instead." "32.1")
(defvar timezone-months-assoc
'(("JAN" . 1)("FEB" . 2)("MAR" . 3)