unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: kbrown@cornell.edu, emacs-devel@gnu.org
Subject: Re: [Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg
Date: Mon, 01 May 2017 10:43:10 +0300	[thread overview]
Message-ID: <83h915ja41.fsf@gnu.org> (raw)
In-Reply-To: <269c5353-d07b-5cf0-4009-3d817351c470@cs.ucla.edu> (message from Paul Eggert on Sun, 30 Apr 2017 13:49:53 -0700)

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sun, 30 Apr 2017 13:49:53 -0700
> 
> Ken Brown wrote:
> > This test fails on Cygwin.
> >
> > (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0)
> >             "NZST-12NZDT,M9.5.0,M4.1.0/3")
> >
> > evaluates to "1970-01-01 12:00:00 +1200 (NZST)".  Can you give me some guidance
> > as to how to track this down?  I know nothing about how time zones work.
> 
> What does this shell command do?
> 
> TZ='NZST-12NZDT,M9.5.0,M4.1.0/3' date -d@0 +'%Y-%m-%d %H:%M:%S %z (%Z)'
> 
> On a working system with GNU 'date', it should output this:
> 
> 1970-01-01 13:00:00 +1300 (NZDT)
> 
> If it outputs "1970-01-01 12:00:00 +1200 (NZST)" on Cygwin, it's a bug in Cygwin 
> not in Emacs per se. If so, perhaps we should just skip the test on Cygwin (you 
> might file a Cygwin bug report). If not, I'll have some other questions to ask.

I've found 2 issues with this test in the MinGW build on MS-Windows.
I would like to propose the following changes.  Paul, is it okay to
commit this?

diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 44595be..80af441 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -144,12 +144,16 @@ transpose-test-get-byte-positions
            (format-time-string "%Y-%m-%d %H:%M:%S %z" '(0 0 0 0) t)
            "1970-01-01 00:00:00 +0000"))
   (should (string-equal
-           (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0) "PST8")
-           "1969-12-31 16:00:00 -0800 (PST)"))
-  (should (string-equal
-           (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0)
-                               "NZST-12NZDT,M9.5.0,M4.1.0/3")
-           "1970-01-01 13:00:00 +1300 (NZDT)")))
+           ;; Use local date of Jan 2, 1970, as MS-Windows produces an empty
+           ;; numerical time-zone from %z for times before the epoch.
+           (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(1 20864 0 0) "PST8")
+           "1970-01-01 16:00:00 -0800 (PST)"))
+  ;; MS-Windows doesn't support the full  Posix format of TZ values.
+  (or (eq system-type 'windows-nt)
+      (should (string-equal
+               (format-time-string "%Y-%m-%d %H:%M:%S %z (%Z)" '(0 0 0 0)
+                                   "NZST-12NZDT,M9.5.0,M4.1.0/3")
+               "1970-01-01 13:00:00 +1300 (NZDT)"))))
 
 ;;; This should not dump core.
 (ert-deftest format-time-string-with-outlandish-zone ()



  parent reply	other threads:[~2017-05-01  7:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170427222412.28742.14016@vcs0.savannah.gnu.org>
     [not found] ` <20170427222413.8FBA722040@vcs0.savannah.gnu.org>
2017-04-30 20:41   ` [Emacs-diffs] master 085c7f6 2/2: Test format-time-string with zone arg Ken Brown
2017-04-30 20:49     ` Paul Eggert
2017-04-30 21:28       ` Ken Brown
2017-05-01 15:02         ` Eli Zaretskii
2017-05-01 16:59           ` Ken Brown
2017-05-01  7:43       ` Eli Zaretskii [this message]
2017-05-01 17:49         ` Paul Eggert
2017-05-01 19:36           ` Eli Zaretskii
2017-05-01 23:05             ` Paul Eggert
2017-05-02  6:29               ` Eli Zaretskii
2017-05-02  7:52                 ` Paul Eggert
2017-05-02 17:09                   ` Eli Zaretskii
2017-05-02 21:55                     ` Bruno Haible
2017-05-02 22:35                       ` Paul Eggert
2017-05-03 15:49                         ` Eli Zaretskii
2017-05-03 15:33                       ` Eli Zaretskii
2017-05-03 19:33                       ` Davis Herring
2017-05-03 21:12                         ` Billy O'Neal (VC LIBS)
2017-05-04 14:26                           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h915ja41.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    --cc=kbrown@cornell.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).