1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Add a variable to allow displaying numeric time zones

* lisp/calendar/calendar.el (calendar-use-numeric-time-zones): New
variable.

* doc/emacs/calendar.texi (Sunrise/Sunset): Document it (bug#33149).

* lisp/calendar/cal-dst.el (calendar-standard-time-zone-name): Use it.
(calendar-daylight-time-zone-name): Ditto.

* lisp/calendar/solar.el (sunrise-sunset): Adjust usage.
(solar-equinoxes-solstices): Ditto.
This commit is contained in:
Lars Ingebrigtsen 2020-08-09 12:34:23 +02:00
parent f3e0da29a2
commit 3c728d4c69
5 changed files with 40 additions and 4 deletions

View file

@ -350,17 +350,29 @@ If the locale never uses daylight saving time, set this to 0."
:group 'calendar-dst)
(defcustom calendar-standard-time-zone-name
(or (nth 2 calendar-current-time-zone-cache) "EST")
(if calendar-use-numeric-time-zones
(if calendar-current-time-zone-cache
(format-time-string
"%z" 0 (* 60 (car calendar-current-time-zone-cache)))
"+0000")
(or (nth 2 calendar-current-time-zone-cache) "EST"))
"Abbreviated name of standard time zone at `calendar-location-name'.
For example, \"EST\" in New York City, \"PST\" for Los Angeles."
:type 'string
:version "28.1"
:group 'calendar-dst)
(defcustom calendar-daylight-time-zone-name
(or (nth 3 calendar-current-time-zone-cache) "EDT")
(if calendar-use-numeric-time-zones
(if calendar-current-time-zone-cache
(format-time-string
"%z" 0 (* 60 (cadr calendar-current-time-zone-cache)))
"+0000")
(or (nth 3 calendar-current-time-zone-cache) "EDT"))
"Abbreviated name of daylight saving time zone at `calendar-location-name'.
For example, \"EDT\" in New York City, \"PDT\" for Los Angeles."
:type 'string
:version "28.1"
:group 'calendar-dst)
(defcustom calendar-daylight-savings-starts-time

View file

@ -1061,6 +1061,13 @@ calendar."
:type 'boolean
:group 'holidays)
(defcustom calendar-use-numeric-time-zones nil
"If nil, use symbolic time zones like \"CET\" when displaying dates.
If non-nil, use numeric time zines like \"+0100\"."
:type 'boolean
:version "28.1"
:group 'calendar)
;;; End of user options.
(calendar-recompute-layout-variables)

View file

@ -840,7 +840,9 @@ This function is suitable for execution in an init file."
"E" "W"))))))
(calendar-standard-time-zone-name
(if (< arg 16) calendar-standard-time-zone-name
(cond ((zerop calendar-time-zone) "UTC")
(cond ((zerop calendar-time-zone)
(if calendar-use-numeric-time-zones
"+0100" "UTC"))
((< calendar-time-zone 0)
(format "UTC%dmin" calendar-time-zone))
(t (format "UTC+%dmin" calendar-time-zone)))))
@ -1013,7 +1015,10 @@ Requires floating point."
(let* ((m displayed-month)
(y displayed-year)
(calendar-standard-time-zone-name
(if calendar-time-zone calendar-standard-time-zone-name "UTC"))
(cond
(calendar-time-zone calendar-standard-time-zone-name)
(calendar-use-numeric-time-zones "+0100")
(t "UTC")))
(calendar-daylight-savings-starts
(if calendar-time-zone calendar-daylight-savings-starts))
(calendar-daylight-savings-ends