localtime() changes tzname
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
eglibc (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Release: 9.10
Version: libc6 2.10.1-0ubuntu16
The following testcase (also attached):
#include <stdio.h>
#include <time.h>
#include <locale.h>
int main(void)
{
time_t t;
tzset();
time(&t);
return 0;
}
Outputs the following:
tzname: (ART,ARST) timezone: 10800 daylight:1
tzname: (ART,ART) timezone: 10800 daylight:0
I think it should output the same tzname twice, but as shown fails to do so when using
Argentina/Buenos Aires timezone.
The timezone has the peculiarity that some years we have DST and some years we don't.
This year we don't. I don't know if it happens with other timezones.
If tzset() is called again after localtime() it does not change the tzname anymore.
As an example of the consequences of this behaviour, this breaks applications that need
to know the names of the local time zone in order to parse them from an external source.
After reading http://
http://
correct output would be:
tzname: (ART,ARST) timezone: 10800 daylight:1
tzname: (ART,ARST) timezone: 10800 daylight:1
because even though there is no DST to be applied currently, there is a name for the
alternative DST timezone, and at some point DST could be applied.
If there is anything else I can do to get this bug fixed, please let me know.
Thanks a lot,
Alberto