On Jan 12 18:32, Christian Franke wrote: > Corinna Vinschen wrote: > >On Jan 7 22:50, Corinna Vinschen wrote: > >>Hi Christian, > >> > >> > >>thanks for the testcase! > >> > >>On Dec 19 19:44, Christian Franke wrote: > >>>$ cat strftest.c > >>>#include <time.h> > >>>#include <stdio.h> > >>>#include <stdlib.h> > >>> > >>>int main(int argc, char **argv) > >>>{ > >>> time_t t = (argc > 1 ? atol(argv[1]) : time(NULL)); > >>> struct tm *tm = localtime(&t); > >>> char buf[100]; > >>> strftime(buf, sizeof(buf), "%Y-%m-%d %H:%M:%S %z (%Z)", tm); > >>> printf("%s\n", buf); > >>> return 0; > >>>} > >>> > >>>$ gcc -o strftest strftest.c > >>> > >>>$ echo $TZ > >>>Europe/Berlin > >>> > >>>$ ./strftest 1419010000 > >>>2014-12-19 18:26:40 +0200 (CET) > >>> > >>>$ ./strftest 1436200000 > >>>2015-07-06 18:26:40 +0053 (CEST) > >>Surprisingly this is an old problem which exists in this form since 2011. > >>Weird that nobody noticed it so far. Or I missed earlier bug reports :} > >>The underlying cause was that the info for std and dst offsets was taken > >>from the wrong spot in the file. The weird 0053 offset is a result of > >>wrongly using the LMT offset for Europe/Berlin. > >> > >>While this fixes the problem for recent timestamps, it will probably > >>fail for older timestamps when other dst rules were active. > >> > >>The latest Cygwin versions come with an extended struct tm which adds > >>members tm_offset and tm_zone for newly built applications. I'm working > >>on a patch so strftime utilizes these members if they are available. > >>I hope to get this finished tomorrow. > >I uploaded a snapshot containing the fixes in tzload and strftime to > >https://cygwin.com/snapshots/ Please give it a try. > > %z now works as expected.
Cool, thank for testing! Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat
pgpanreNsZNxx.pgp
Description: PGP signature