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
This commit is contained in:
Bruce Allen 2005-05-05 20:13:00 +00:00
parent 27aacefb20
commit 3dbc45650f
2 changed files with 12 additions and 13 deletions

View File

@ -6057,14 +6057,16 @@ David 4 May 2005
schema.sql schema.sql
Bruce 4 May 2005 Bruce 4 May 2005
- bug fix so that Unix hosts report their timezones correctly. - bug fix so that Unix hosts report their timezones correctly
NOTE: hosts that lack a gmt offset in the tm structure (System V taking into account the effect of DST on their localtime.
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.
- 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 timezone value is the (Local Standard Time) - (UTC time). This
quantity only depends upon spatial location on the earth's surface and quantity only depends upon spatial location on the earth's surface and
is NOT a function of time. is NOT a function of time.

View File

@ -118,14 +118,11 @@ int get_timezone() {
return time_data->tm_gmtoff; return time_data->tm_gmtoff;
} }
#elif defined(linux) #elif defined(linux)
return __timezone; return -1*(__timezone);
// SHOULD BE -1*__timezone;
#elif defined(__CYGWIN32__) #elif defined(__CYGWIN32__)
return _timezone; return -1*(_timezone);
// SHOULD BE -1*_timezone;
#elif defined(unix) #elif defined(unix)
return timezone; return -1*timezone;
// SHOULD BE -1*timezone;
#else #else
#error timezone #error timezone
#endif #endif