Use dot-time format for modeline timestamp

My current understanding of how computers deal with time:
- Modelling time is easy: use the number of seconds that have elapsed since the
  Unix epoch.
- Display time is complicated. Which timezone should we use? Which format
  string?
This commit is contained in:
William Carroll 2020-06-16 11:46:17 +01:00
parent 675b8084c7
commit b1e358f247

View file

@ -6,10 +6,18 @@
;;; Code:
;; Display time in the modeline
;; TODO: Save preferred date format strings and cycle through them since I waver
;; about which is my favorite.
(setq display-time-format "%R %a %d %b [%U of 52 weeks]")
;; I'm borrowing from the dot-time format (i.e. https://dotti.me) to encode the
;; timestamp. This displays the UTC time and an offset to show the number of
;; hours East or West of UTC my current timezone is using `current-time-zone'.
;;
;; Reminder to me:
;; LON: +00 (UTC) or +01 (BST)
;; NYC: -05
;; SF: -07
(setq display-time-format
(concat "%H·%M"
(format "%0+3d" (/ (car (current-time-zone)) 3600))
" %a %d %b [%U of 52 weeks]"))
(display-time-mode 1)
;; disable custom variable entries from being written to ~/.emacs.d/init.el