aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2019-07-31 19:21:50 -0700
committerPaul Eggert2019-07-31 19:24:13 -0700
commitf8f1c8c33a0a8fa117bf06e3b34865dea48eb6a1 (patch)
tree8848384237d3283acb0ab05770195e244cfc3216
parent5f78e81af0c2648391f26602189c565627e08218 (diff)
downloademacs-f8f1c8c33a0a8fa117bf06e3b34865dea48eb6a1.tar.gz
emacs-f8f1c8c33a0a8fa117bf06e3b34865dea48eb6a1.zip
format-time-string subsumes time-zone-format
* lisp/calendar/time-date.el (time-zone-format): * test/lisp/calendar/time-date-tests.el (test-time-zone-format): Remove. * lisp/gnus/nnrss.el (nnrss-normalize-date): Use format-time-string instead of time-zone-format.
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/calendar/time-date.el14
-rw-r--r--lisp/gnus/nnrss.el2
-rw-r--r--test/lisp/calendar/time-date-tests.el6
4 files changed, 1 insertions, 25 deletions
diff --git a/etc/NEWS b/etc/NEWS
index e1ac4eb9337..486e677539d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2110,10 +2110,6 @@ doing computations on a decoded time structure), 'make-decoded-time'
2110filled out), and 'encoded-time-set-defaults' (which fills in nil 2110filled out), and 'encoded-time-set-defaults' (which fills in nil
2111elements as if it's midnight January 1st, 1970) have been added. 2111elements as if it's midnight January 1st, 1970) have been added.
2112 2112
2113*** The new function `time-zone-format' has been added to format
2114Emacs time zones (which are in seconds) according to many standards
2115(i.e., "+01:00").
2116
2117** 'define-minor-mode' automatically documents the meaning of ARG. 2113** 'define-minor-mode' automatically documents the meaning of ARG.
2118 2114
2119+++ 2115+++
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index b94bf52760d..32ba1286895 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -352,20 +352,6 @@ is output until the first non-zero unit is encountered."
352 (<= (car here) delay))) 352 (<= (car here) delay)))
353 (concat (format "%.2f" (/ delay (car (cddr here)))) (cadr here)))))) 353 (concat (format "%.2f" (/ delay (car (cddr here)))) (cadr here))))))
354 354
355(defun time-zone-format (seconds &optional short)
356 "Format SECONDS as a valid time zone string.
357For instance, 3600 is \"+01:00\".
358If SHORT, the colon isn't included."
359 (format "%s%02d%s%02d"
360 (if (< seconds 0)
361 "-"
362 "+")
363 (/ (abs seconds) 3600)
364 (if short
365 ""
366 ":")
367 (mod (abs seconds) 3600)))
368
369(defun date-days-in-month (year month) 355(defun date-days-in-month (year month)
370 "The number of days in MONTH in YEAR." 356 "The number of days in MONTH in YEAR."
371 (if (= month 2) 357 (if (= month 2)
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index f2c86ee44e8..82d3f574249 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -487,7 +487,7 @@ which RSS 2.0 allows."
487 (format "%s, %02d %s %04d %s%s" 487 (format "%s, %02d %s %04d %s%s"
488 (substring cts 0 3) day (substring cts 4 7) year time 488 (substring cts 0 3) day (substring cts 4 7) year time
489 (if zone 489 (if zone
490 (concat " " (time-zone-format zone t)) 490 (concat " " (format-time-string "%z" nil zone))
491 ""))) 491 "")))
492 (message-make-date given)))) 492 (message-make-date given))))
493 493
diff --git a/test/lisp/calendar/time-date-tests.el b/test/lisp/calendar/time-date-tests.el
index 51250ce5e7a..b46a247cd30 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -104,12 +104,6 @@
104 (should (equal (decoded-time-add time (mdec :zone -7200)) 104 (should (equal (decoded-time-add time (mdec :zone -7200))
105 '(12 15 14 8 7 2019 1 t 7200))))) 105 '(12 15 14 8 7 2019 1 t 7200)))))
106 106
107(ert-deftest test-time-zone-format ()
108 (should (equal (time-zone-format 3600)
109 "+01:00"))
110 (should (equal (time-zone-format -7200)
111 "-02:00")))
112
113(require 'ert) 107(require 'ert)
114 108
115;;; time-date-tests.el ends here 109;;; time-date-tests.el ends here