summaryrefslogtreecommitdiff
path: root/lisp/calendar/time-date.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-07-30 16:56:12 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2019-07-31 21:47:29 +0200
commit46df7bbe12cce4c9af7ce4357aa9f8d36c1d8933 (patch)
treebb2e88c7866ff6984a2398ec74c69a58bac8b7d5 /lisp/calendar/time-date.el
parent07ce3be6aa15fdf2092bdf3c60a132d5f4b9c980 (diff)
downloademacs-46df7bbe12cce4c9af7ce4357aa9f8d36c1d8933.tar.gz
Add new function time-zone-format
* lisp/calendar/time-date.el (time-zone-format): New function.
Diffstat (limited to 'lisp/calendar/time-date.el')
-rw-r--r--lisp/calendar/time-date.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index f14478e67cc..efc9ae4e3b9 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -352,6 +352,16 @@ is output until the first non-zero unit is encountered."
(<= (car here) delay)))
(concat (format "%.2f" (/ delay (car (cddr here)))) (cadr here))))))
+(defun time-zone-format (seconds)
+ "Format SECONDS as a valid time zone string.
+For instance, 3600 is \"+01:00\"."
+ (format "%s%02d:%02d"
+ (if (< seconds 0)
+ "-"
+ "+")
+ (/ (abs seconds) 3600)
+ (mod (abs seconds) 3600)))
+
(defun date-days-in-month (year month)
"The number of days in MONTH in YEAR."
(if (= month 2)