Debug dottime in modeline

My modeline was displaying the local time (not UTC time) and appending the UTC
timezone offset, which was confusing me.

When it was `00:03` in London, my modeline would read `00:03+01`. One way of
interpreting this is that it's `00:03` in London and the `+01` is a reminder
that I'm one hour ahead of UTC. However, I was reading it as though it was
`00:03` UTC and thus `01:03` in London.

I had to set `display-time-string-forms` instead of `display-time-string` to
pass the `t` argument to the `ZONE` parameter to indicate that I'd prefer to use
UTC time and not local time when expanding the variables.
This commit is contained in:
William Carroll 2020-09-28 00:02:40 +01:00
parent 1ad6c30acc
commit 34ec3104f7

View file

@ -33,10 +33,11 @@
;; LON: +00 (UTC) or +01 (BST) ;; LON: +00 (UTC) or +01 (BST)
;; NYC: -05 ;; NYC: -05
;; SF: -07 ;; SF: -07
(setq display-time-format (setq display-time-string-forms
(concat "%H·%M" '((format-time-string
(format "%0+3d" (/ (car (current-time-zone)) 3600)) (concat "%H·%M"
" %a %d %b")) (format "%0+3d" (/ (car (current-time-zone)) 3600))
" %a %d %b") nil t)))
(display-time-mode 1) (display-time-mode 1)
;; Remove the boilerplate in the *scratch* buffer ;; Remove the boilerplate in the *scratch* buffer