Bug - Default TZ not always UTC.

From Owen:

I tried mktime on Darwin an Linux; looks like they both default to UTC if the TZ
environment variable is unset but on Solaris it defaults to the local timezone.
I compiled and ran the tests and checked the behaviour by running:

date
TZ="" date
TZ="UTC" date

On Solaris the first two are in local time and the third is in UTC.
On Darwin and Linux the first one is in local time and the other two are in UTC.

Found this as a reference, too, which mentions the suggested implementation in
'man 3 timegm':

http://stackoverflow.com/questions/6467844/is-c-mktime-different-on-windows-and-gnu-linux

Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
Owen Clarke 2012-01-05 18:05:58 -05:00 committed by Paul Beckingham
parent afcd362f67
commit 7c90d1e8cc
2 changed files with 2 additions and 1 deletions

View file

@ -234,6 +234,7 @@
Barton Meeks).
+ Fixed problem with duplicate 'project changed' messages (thanks to Owen
Clarke).
+ Fixed problem with non-UTC defaults for "TZ" (thanks to Owen Clarke).
------ old releases ------------------------------

View file

@ -672,7 +672,7 @@ bool Nibbler::getDateISO (time_t& t)
tms.tm_sec = second;
char *tz = getenv ("TZ");
setenv ("TZ", "", 1);
setenv ("TZ", "UTC", 1);
tzset ();
t = mktime (&tms);
if (tz)