From 7c90d1e8cc70d38e95d106c0b87acad26dff8f20 Mon Sep 17 00:00:00 2001 From: Owen Clarke Date: Thu, 5 Jan 2012 18:05:58 -0500 Subject: [PATCH] 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 --- ChangeLog | 1 + src/Nibbler.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 61e3accf6..08776414c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 ------------------------------ diff --git a/src/Nibbler.cpp b/src/Nibbler.cpp index 332ee159c..a51abfe02 100644 --- a/src/Nibbler.cpp +++ b/src/Nibbler.cpp @@ -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)