From 3dbc45650fb84ba2b98b3f93409a79adc8b6a92b Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Thu, 5 May 2005 20:13:00 +0000 Subject: [PATCH] Timezone sign fix for those rare Unix hosts (AIX, Cygwin??) which lack a gmoffset field in their tm time structure. This makes them consistent with Win32 and all other Unix hosts. svn path=/trunk/boinc/; revision=6044 --- checkin_notes | 16 +++++++++------- client/hostinfo_unix.C | 9 +++------ 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/checkin_notes b/checkin_notes index b8f5745d10..54ea9a0691 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6057,14 +6057,16 @@ David 4 May 2005 schema.sql Bruce 4 May 2005 - - bug fix so that Unix hosts report their timezones correctly. - NOTE: hosts that lack a gmt offset in the tm structure (System V - with no BSD extensions) will have the WRONG SIGN for the timezone. - This can be fixed by changing the signs of __timezone, _timezone and - timezone in get_timezone(), but I won't do it until David signs - off. + - bug fix so that Unix hosts report their timezones correctly + taking into account the effect of DST on their localtime. - - Note that with this change we adopt the convention that the database + NOTE: hosts that lacked a gmt offset in the tm structure (System V + with no BSD extensions) had the WRONG SIGN for the timezone. + This is now fixed. These host types (AIX, Cygwin?) will now have a + change in sign in their timezone, making it consistent with other + Unix hosts and with Win32 hosts. + + - Note that with these changes we adopt the convention that the database timezone value is the (Local Standard Time) - (UTC time). This quantity only depends upon spatial location on the earth's surface and is NOT a function of time. diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index 0655eb2eff..ac0b81db81 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -118,14 +118,11 @@ int get_timezone() { return time_data->tm_gmtoff; } #elif defined(linux) - return __timezone; - // SHOULD BE -1*__timezone; + return -1*(__timezone); #elif defined(__CYGWIN32__) - return _timezone; - // SHOULD BE -1*_timezone; + return -1*(_timezone); #elif defined(unix) - return timezone; - // SHOULD BE -1*timezone; + return -1*timezone; #else #error timezone #endif