emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master f8f1c8c: format-time-string subsumes time-zone-form


From: Paul Eggert
Subject: [Emacs-diffs] master f8f1c8c: format-time-string subsumes time-zone-format
Date: Wed, 31 Jul 2019 22:24:19 -0400 (EDT)

branch: master
commit f8f1c8c33a0a8fa117bf06e3b34865dea48eb6a1
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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.
---
 etc/NEWS                              |  4 ----
 lisp/calendar/time-date.el            | 14 --------------
 lisp/gnus/nnrss.el                    |  2 +-
 test/lisp/calendar/time-date-tests.el |  6 ------
 4 files changed, 1 insertion(+), 25 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index e1ac4eb..486e677 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2110,10 +2110,6 @@ doing computations on a decoded time structure), 
'make-decoded-time'
 filled out), and 'encoded-time-set-defaults' (which fills in nil
 elements as if it's midnight January 1st, 1970) have been added.
 
-*** The new function `time-zone-format' has been added to format
-Emacs time zones (which are in seconds) according to many standards
-(i.e., "+01:00").
-
 ** 'define-minor-mode' automatically documents the meaning of ARG.
 
 +++
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index b94bf52..32ba128 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."
                          (<= (car here) delay)))
              (concat (format "%.2f" (/ delay (car (cddr here)))) (cadr 
here))))))
 
-(defun time-zone-format (seconds &optional short)
-  "Format SECONDS as a valid time zone string.
-For instance, 3600 is \"+01:00\".
-If SHORT, the colon isn't included."
-  (format "%s%02d%s%02d"
-          (if (< seconds 0)
-              "-"
-            "+")
-          (/ (abs seconds) 3600)
-          (if short
-              ""
-            ":")
-          (mod (abs seconds) 3600)))
-
 (defun date-days-in-month (year month)
   "The number of days in MONTH in YEAR."
   (if (= month 2)
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index f2c86ee..82d3f57 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -487,7 +487,7 @@ which RSS 2.0 allows."
          (format "%s, %02d %s %04d %s%s"
                  (substring cts 0 3) day (substring cts 4 7) year time
                  (if zone
-                     (concat " " (time-zone-format zone t))
+                     (concat " " (format-time-string "%z" nil zone))
                    "")))
       (message-make-date given))))
 
diff --git a/test/lisp/calendar/time-date-tests.el 
b/test/lisp/calendar/time-date-tests.el
index 51250ce..b46a247 100644
--- a/test/lisp/calendar/time-date-tests.el
+++ b/test/lisp/calendar/time-date-tests.el
@@ -104,12 +104,6 @@
     (should (equal (decoded-time-add time (mdec :zone -7200))
                    '(12 15 14 8 7 2019 1 t 7200)))))
 
-(ert-deftest test-time-zone-format ()
-  (should (equal (time-zone-format 3600)
-                 "+01:00"))
-  (should (equal (time-zone-format -7200)
-                 "-02:00")))
-
 (require 'ert)
 
 ;;; time-date-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]