aboutsummaryrefslogtreecommitdiff
path: root/emacs/.emacs.d/lisp
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-11-05 20:11:17 +1100
committerYuchen Pei <id@ypei.org>2023-11-05 20:11:17 +1100
commitb5a91d87d4933ce50675b253a5853787143bc660 (patch)
treefc240f717ba8474d8f848b38279b160d0a169e87 /emacs/.emacs.d/lisp
parente94a7e4edc90ab8bbcf3a60b4f9d0771a1b08d73 (diff)
[emacs] A utility function for parsing epoch
Diffstat (limited to 'emacs/.emacs.d/lisp')
-rw-r--r--emacs/.emacs.d/lisp/my/my-utils.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/emacs/.emacs.d/lisp/my/my-utils.el b/emacs/.emacs.d/lisp/my/my-utils.el
index db7e804..c64c9ac 100644
--- a/emacs/.emacs.d/lisp/my/my-utils.el
+++ b/emacs/.emacs.d/lisp/my/my-utils.el
@@ -45,6 +45,12 @@
(defun my-delete-http-header ()
(delete-region (point-min) (progn (my-skip-http-header) (point))))
+(defun my-time-from-epoch (t)
+ "Encode time from epoch T.
+
+Example: (format-time-string ... (my-time-from-epoch 1698582504))"
+ (encode-time (decode-time t)))
+
;; lists
(defun my-list-cycle (xs)
"Cycle a list."