This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
"daylight" variable set wrong for Europe/Berlin?
- From: "U.Mutlu" <for-gmane at mutluit dot com>
- To: libc-help at sourceware dot org
- Date: Sat, 19 Mar 2016 15:30:12 +0100
- Subject: "daylight" variable set wrong for Europe/Berlin?
- Authentication-results: sourceware.org; auth=none
Hi,
according to this site: http://www.timeanddate.com/time/change/germany/berlin
the daylight saving time in Germany (TZ="Europe/Berlin") begins
on 2016-March-27 at 02:00 and ends on 2016-Oct-30 at 03:00.
My system's default timezone is set to "Europe/Berlin" (system is Debian Linux 8).
But the "daylight" global variable has the value 1 today.
Is that not a bug? Shouldn't that variable be 1 only in the
above said daylight saving period?
Also, when I in a C/C++ program set the TZ environment variable
explicitly to "Europe/Berlin" I get the same result.
What's the logic behind this illogic? ;-)
$ ./a.out
t = time(0) = 1458397599
ctime(&t) = Sat Mar 19 15:26:39 2016
mktime(localtime(&t)) = 1458397599
mktime(gmtime(&t)) = 1458393999
difftime(...) = -3600.000000
tzname[0] = CET
tzname[1] = CEST
timezone = -3600
daylight = 1
switching to TZ=Europe/Berlin
t = time(0) = 1458397599
ctime(&t) = Sat Mar 19 15:26:39 2016
mktime(localtime(&t)) = 1458397599
mktime(gmtime(&t)) = 1458393999
difftime(...) = -3600.000000
tzname[0] = CET
tzname[1] = CEST
timezone = -3600
daylight = 1