[PATCH] test-parse-date: fix timezone name used to test local time with DST

Yuya Nishihara yuya at tcha.org
Mon Feb 15 07:52:50 EST 2016


On Mon, 15 Feb 2016 08:04:40 +0100, Sébastien Brissaud wrote:
> On 2016-02-13 09:19, Yuya Nishihara wrote:
> > On Sat, 13 Feb 2016 07:24:11 +0100, Sébastien Brissaud wrote:
> >> On 2016-02-11 07:29, Yuya Nishihara wrote:
> 
> >> > http://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html
> 
> Re-reading this page, DST start/end aren't optional and need to be
> specified.

Indeed. It seems glibc is permissive, but the doc doesn't state it.

> On my system, '/usr/share/zoneinfo/posixrules' defines time in the 
> EST/EDT timezone.
> 
> $ zdump -v /usr/share/zoneinfo/posixrules | cut -d ' ' -f 3- | grep 2006
> Sun Apr  2 06:59:59 2006 UT = Sun Apr  2 01:59:59 2006 EST isdst=0 gmtoff=-18000
> Sun Apr  2 07:00:00 2006 UT = Sun Apr  2 03:00:00 2006 EDT isdst=1 gmtoff=-14400
> Sun Oct 29 05:59:59 2006 UT = Sun Oct 29 01:59:59 2006 EDT isdst=1 gmtoff=-14400
> Sun Oct 29 06:00:00 2006 UT = Sun Oct 29 01:00:00 2006 EST isdst=0 gmtoff=-18000

FYI, I got exactly the same result om my machine.

> And that is certainly why my system correctly applied DST with e.g. 
> TZ='PST+5PDT' but not with TZ='PST+8PDT'.
> 
> > If PST8PDT can provide more stable result, it will be fine to use that 
> > TZ
> > value. Can you resend the patch with updated commit message?
> 
> TZ can be defined to a timezone file (TZ=":PST8PDT") but this file is 
> now expected to be present on the system running the test.
> (https://www.gnu.org/software/libc/manual/html_node/TZ-Variable.html#TZ-Variable 
> defines the third format as ':characters' but the implementation 
> silently ignore it: 
> https://sourceware.org/git/?p=glibc.git;a=blob;f=time/tzset.c;h=8bc7a2e05bb83e9e6e37d6f2b6db2d6ad49b9b8b;hb=4e42b5b8f89f0e288e68be7ad70f9525aebc2cff#l424))
> 
> We can also define TZ by using the second format 
> (TZ="PST+8PDT+7,M4.1.0/02:00:00,M10.5.0/02:00:00") and thus only 
> requiring the system running the test to be POSIX compliant.
> 
> I prefer the second option which I found more explicit about the offset 
> definition and DST transitions.

I like the explicit version if it is cross-platform enough. It worked on
Windows, so perhaps it is okay.


More information about the Mercurial-devel mailing list