unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
       [not found] ` <20191001032458.E3A4D207F5@vcs0.savannah.gnu.org>
@ 2019-10-09 12:51   ` Stefan Kangas
  2019-10-09 13:00     ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2019-10-09 12:51 UTC (permalink / raw)
  To: Stephen Gildea, Emacs developers

Stephen Gildea <stepheng+savannah@gildea.com> writes:

> branch: master
> commit 0e568838781a4a5f2970bff6245c4e41f31612cc
> Author: Stephen Gildea <stepheng+git-config-global@gildea.com>
> Commit: Stephen Gildea <stepheng+git-config-global@gildea.com>
>
>     Move undocumented time-stamp formats closer to format-time-string
>
>     * time-stamp.el (time-stamp-string-preprocess): Update some undocumented
>     formatting characters of time-stamp format for closer (still incomplete)
>     alignment with format-time-string.  They have displayed a warning since
>     Emacs 20 (released in 1997), so it is unlikely anyone is using them.
>
>     * time-stamp-tests.el: Update tests to match new expectations.

This commit gives test failures on macOS:

Test time-stamp-test-time-zone backtrace:
  signal(ert-test-failed (((should (equal (time-stamp-string "%z" ref-
  ert-fail(((should (equal (time-stamp-string "%z" ref-time) "gmt")) :
  #f(compiled-function () #<bytecode 0x1ff1b9e1e9dd>)()
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name time-stamp-test-time-zone :documentat
  ert-run-or-rerun-test(#s(ert--stats :selector ... :tests ... :test-m
  ert-run-tests((not (or (tag :expensive-test) (tag :unstable))) #f(co
  ert-run-tests-batch((not (or (tag :expensive-test) (tag :unstable)))
  ert-run-tests-batch-and-exit((not (or (tag :expensive-test) (tag :un
  eval((ert-run-tests-batch-and-exit '(not (or (tag :expensive-test) (
  command-line-1(("-L" ":." "-l" "ert" "-l" "lisp/time-stamp-tests" "-
  command-line()
  normal-top-level()
Test time-stamp-test-time-zone condition:
    (ert-test-failed
     ((should
       (equal
    (time-stamp-string "%z" ref-time)
    "gmt"))
      :form
      (equal "utc" "gmt")
      :value nil :explanation
      (array-elt 0
         (different-atoms
          (117 "#x75" "?u")
          (103 "#x67" "?g")))))
   FAILED  19/20  time-stamp-test-time-zone (0.000110 sec)
   passed  20/20  time-stamp-test-year (0.000182 sec)

Ran 20 tests, 19 results as expected, 1 unexpected (2019-10-09
14:35:26+0200, 0.145782 sec)

1 unexpected results:
   FAILED  time-stamp-test-time-zone

Best regards,
Stefan Kangas



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
  2019-10-09 12:51   ` [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string Stefan Kangas
@ 2019-10-09 13:00     ` Stefan Kangas
  2019-10-09 18:52       ` Eli Zaretskii
  2019-10-09 21:31       ` Stephen Gildea
  0 siblings, 2 replies; 6+ messages in thread
From: Stefan Kangas @ 2019-10-09 13:00 UTC (permalink / raw)
  To: Stephen Gildea, Emacs developers

[-- Attachment #1: Type: text/plain, Size: 221 bytes --]

> 1 unexpected results:
>    FAILED  time-stamp-test-time-zone

The attached patch seems to fix it, but I don't know enough about this
stuff to know if it's the right one.  What do you think?

Best regards,
Stefan Kangas

[-- Attachment #2: 0001-Fix-one-time-stamp.el-test-on-macOS.patch --]
[-- Type: application/octet-stream, Size: 1341 bytes --]

From 7cfd3045814753c23d0fff512523ba5de43b18f9 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Wed, 9 Oct 2019 14:59:53 +0200
Subject: [PATCH] Fix one time-stamp.el test on macOS

* test/lisp/time-stamp-tests.el (time-stamp-test-time-zone): Fix test
on macOS.
---
 test/lisp/time-stamp-tests.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index d710564c36..d1ebaf8cfb 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -283,11 +283,11 @@ time-stamp-test-time-zone
   "Test time-stamp formats for time zone."
   (with-time-stamp-test-env
     ;; implemented and documented since 1995
-    (should (equal (time-stamp-string "%Z" ref-time) "GMT"))
+    (should (member (time-stamp-string "%Z" ref-time) '("GMT" "UTC")))
     ;; documented 1995-2019
-    (should (equal (time-stamp-string "%z" ref-time) "gmt"))
+    (should (member (time-stamp-string "%z" ref-time) '("gmt" "utc")))
     ;; implemented since 1997, documented since 2019
-    (should (equal (time-stamp-string "%#Z" ref-time) "gmt"))))
+    (should (member (time-stamp-string "%#Z" ref-time) '("gmt" "utc")))))
 
 (ert-deftest time-stamp-test-non-date-conversions ()
   "Test time-stamp formats for non-date items."
-- 
2.23.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
  2019-10-09 13:00     ` Stefan Kangas
@ 2019-10-09 18:52       ` Eli Zaretskii
  2019-10-10  7:17         ` Paul Eggert
  2019-10-09 21:31       ` Stephen Gildea
  1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2019-10-09 18:52 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: stepheng+savannah, emacs-devel

> From: Stefan Kangas <stefan@marxist.se>
> Date: Wed, 9 Oct 2019 15:00:40 +0200
> 
> The attached patch seems to fix it, but I don't know enough about this
> stuff to know if it's the right one.  What do you think?

GMT and UTC are not identical.  Do you understand why macOS returns
UTC where GMT is expected?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
  2019-10-09 13:00     ` Stefan Kangas
  2019-10-09 18:52       ` Eli Zaretskii
@ 2019-10-09 21:31       ` Stephen Gildea
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Gildea @ 2019-10-09 21:31 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Emacs developers

Your patch seems reasonable to me.  I would add a comment that the
"UTC" is for MacOS.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
  2019-10-09 18:52       ` Eli Zaretskii
@ 2019-10-10  7:17         ` Paul Eggert
  2019-10-10 10:56           ` Stefan Kangas
  0 siblings, 1 reply; 6+ messages in thread
From: Paul Eggert @ 2019-10-10  7:17 UTC (permalink / raw)
  To: Eli Zaretskii, Stefan Kangas; +Cc: stepheng+savannah, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 432 bytes --]

On 10/9/19 11:52 AM, Eli Zaretskii wrote:
> Do you understand why macOS returns UTC where GMT is expected?

Yes, it's what the low-level gmtime_r function returns in its struct tm. This 
aspect of gmtime_r is not standardized, and some implementations return "GMT", 
some "UTC", and I vaguely recall seeing other abbreviations.

I installed the attached patch, which should fix the problem though I've tested 
it only on GNU/Linux.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Port-time-stamp-test-time-zone-to-macOS.patch --]
[-- Type: text/x-patch; name="0001-Port-time-stamp-test-time-zone-to-macOS.patch", Size: 1906 bytes --]

From a05609991f68de5825b37a9ed6b1e5d2cccbd2ae Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Thu, 10 Oct 2019 00:15:24 -0700
Subject: [PATCH] Port time-stamp-test-time-zone to macOS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Problem reported by Stefan Kangas in:
https://lists.gnu.org/r/emacs-devel/2019-10/msg00360.html
* test/lisp/time-stamp-tests.el (time-stamp-test-time-zone):
Don’t assume (format-time-string "%Z" 0 t) returns "GMT".
---
 test/lisp/time-stamp-tests.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/test/lisp/time-stamp-tests.el b/test/lisp/time-stamp-tests.el
index ace5e58e36..37822f6e29 100644
--- a/test/lisp/time-stamp-tests.el
+++ b/test/lisp/time-stamp-tests.el
@@ -298,12 +298,14 @@ time-stamp-test-day-number-in-week
 (ert-deftest time-stamp-test-time-zone ()
   "Test time-stamp formats for time zone."
   (with-time-stamp-test-env
-    ;; implemented and documented since 1995
-    (should (equal (time-stamp-string "%Z" ref-time) "GMT"))
-    ;; documented 1995-2019
-    (should (equal (time-stamp-string "%z" ref-time) "gmt"))
-    ;; implemented since 1997, documented since 2019
-    (should (equal (time-stamp-string "%#Z" ref-time) "gmt"))))
+    (let ((UTC-abbr (format-time-string "%Z" ref-time t))
+	  (utc-abbr (format-time-string "%#Z" ref-time t)))
+      ;; implemented and documented since 1995
+      (should (equal (time-stamp-string "%Z" ref-time) UTC-abbr))
+      ;; documented 1995-2019
+      (should (equal (time-stamp-string "%z" ref-time) utc-abbr))
+      ;; implemented since 1997, documented since 2019
+      (should (equal (time-stamp-string "%#Z" ref-time) utc-abbr)))))
 
 (ert-deftest time-stamp-test-non-date-conversions ()
   "Test time-stamp formats for non-date items."
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string
  2019-10-10  7:17         ` Paul Eggert
@ 2019-10-10 10:56           ` Stefan Kangas
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Kangas @ 2019-10-10 10:56 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Eli Zaretskii, Stephen Gildea, Emacs developers

Paul Eggert <eggert@cs.ucla.edu> writes:

> I installed the attached patch, which should fix the problem though I've tested
> it only on GNU/Linux.

Your patch fixed the problem on macOS and looks better than the one I
proposed.  Thanks.

Best regards,
Stefan Kangas



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-10-10 10:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20191001032457.2675.32057@vcs0.savannah.gnu.org>
     [not found] ` <20191001032458.E3A4D207F5@vcs0.savannah.gnu.org>
2019-10-09 12:51   ` [Emacs-diffs] master 0e56883: Move undocumented time-stamp formats closer to format-time-string Stefan Kangas
2019-10-09 13:00     ` Stefan Kangas
2019-10-09 18:52       ` Eli Zaretskii
2019-10-10  7:17         ` Paul Eggert
2019-10-10 10:56           ` Stefan Kangas
2019-10-09 21:31       ` Stephen Gildea

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).