about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-06-16T10·46+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-06-16T10·46+0100
commitb1e358f247714970ff0823455c81b16fd2a1a994 (patch)
tree33bddf40df0d92247f0e7d1fdf16413d37ccd83b
parent675b8084c74b82871b70525501dd12e1f6be97f7 (diff)
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?
-rw-r--r--emacs/.emacs.d/wpc/wpc-misc.el16
1 files changed, 12 insertions, 4 deletions
diff --git a/emacs/.emacs.d/wpc/wpc-misc.el b/emacs/.emacs.d/wpc/wpc-misc.el
index f3fe05719770..1483c53af244 100644
--- a/emacs/.emacs.d/wpc/wpc-misc.el
+++ b/emacs/.emacs.d/wpc/wpc-misc.el
@@ -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