>From bc921e840783f0e9cb985d02d6ea2138ecdc01c9 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 1 May 2017 16:02:31 -0700 Subject: [PATCH] Port format-time-string to MS-Windows better * test/src/editfns-tests.el (format-time-string-with-zone): Port test cases to MS-Windows. --- test/src/editfns-tests.el | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el index 7c555d9..8019eb0 100644 --- a/test/src/editfns-tests.el +++ b/test/src/editfns-tests.el @@ -148,25 +148,28 @@ transpose-test-get-byte-positions ;; 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 () -- 2.9.3