From: Paul Eggert Date: Mon, 1 May 2017 23:02:31 +0000 (-0700) Subject: Port format-time-string to MS-Windows better X-Git-Tag: emacs-26.0.90~521^2~490 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d36b0c2c80029880809e5a101eeb01da9fd9c219;p=emacs.git Port format-time-string to MS-Windows better * test/src/editfns-tests.el (format-time-string-with-zone): Port test cases to MS-Windows. --- diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 7c555d9f9c6..8019eb03838 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -148,25 +148,28 @@ ;; second on 1972-06-30 23:59:60 UTC, so it should format to the ;; same string regardless of whether the underlying C library ;; ignores leap seconds, while avoiding circa-1970 glitches. - (let ((look '(1202 22527 999999 999999))) + ;; + ;; Similarly, stick to the limited set of time zones that are + ;; supported by both POSIX and MS-Windows: exactly 3 ASCII letters + ;; in the abbreviation, and no DST. + (let ((look '(1202 22527 999999 999999)) + (format "%Y-%m-%d %H:%M:%S.%3N %z (%Z)")) ;; UTC. (should (string-equal (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z" look t) "1972-06-30 23:59:59.999 +0000")) - ;; Time zone without DST in 1972. + ;; "UTC0". (should (string-equal - (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z (%Z)" look "NZST-12") - "1972-07-01 11:59:59.999 +1200 (NZST)")) - ;; United States DST in 1972. + (format-time-string format look "UTC0") + "1972-06-30 23:59:59.999 +0000 (UTC)")) + ;; Negative UTC offset, as a Lisp list. (should (string-equal - (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z (%Z)" look - "PST8PDT,M4.5.0,M10.5.0") - "1972-06-30 16:59:59.999 -0700 (PDT)")) - ;; New South Wales DST in 1971-2. + (format-time-string format look '(-28800 "PST")) + "1972-06-30 15:59:59.999 -0800 (PST)")) + ;; Positive UTC offset that is not an hour multiple, as a string. (should (string-equal - (format-time-string "%Y-%m-%d %H:%M:%S.%3N %z (%Z)" look - "AEST-10AEDT,M10.5.0,M2.5.0/3") - "1972-07-01 09:59:59.999 +1000 (AEST)")))) + (format-time-string format look "IST-5:30") + "1972-07-01 05:29:59.999 +0530 (IST)")))) ;;; This should not dump core. (ert-deftest format-time-string-with-outlandish-zone ()