diff options
Diffstat (limited to 'init.el')
-rw-r--r-- | init.el | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -485,6 +485,22 @@ display-time-default-load-average nil display-time-format " %a %e %H:%M") +(defun jao-time-to-epoch (&optional s) + "Transform a time string to an epoch integer in milliseconds." + (interactive) + (let ((s (or s (read-string "Time string: " (thing-at-point 'string))))) + (message "%s = %s" + s + (round (* 1000 (time-to-seconds (parse-time-string s))))))) + +(defun jao-epoch-to-time (&optional v) + "Transform an epoch, given in milliseconds, to a time string." + (interactive) + (let ((v (or v (read-number "Milliseconds: " (thing-at-point 'number))))) + (message "%s = %s" v + (format-time-string "%Y-%m-%d %H:%M:%S" + (seconds-to-time (/ v 1000.0)))))) + ;;;; mode line toggle (use-package jao-mode-line :init |