diff options
author | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-06-17 20:19:06 +0000 |
---|---|---|
committer | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2004-06-17 20:19:06 +0000 |
commit | c3f5518c09087b3e7882a530f55a2d1248a805b2 (patch) | |
tree | 96f3678859b6d5572d8c88eb797e871c40693417 /ace/OS_NS_time.h | |
parent | 1dd5d74bd6224243d60a16c6de4451084143bf45 (diff) | |
download | ATCD-c3f5518c09087b3e7882a530f55a2d1248a805b2.tar.gz |
ChangeLogTag: Thu Jun 17 12:48:09 2004 J.T. Conklin <jtc@acorntoolworks.com>
Diffstat (limited to 'ace/OS_NS_time.h')
-rw-r--r-- | ace/OS_NS_time.h | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/ace/OS_NS_time.h b/ace/OS_NS_time.h index 2312a7333c0..9094436d712 100644 --- a/ace/OS_NS_time.h +++ b/ace/OS_NS_time.h @@ -149,25 +149,31 @@ inline long ace_timezone() time_t t1 = mktime(gmtime(&tod)); // convert without timezone time_t t2 = mktime(localtime(&tod)); // convert with timezone return difftime(t1, t2); // compute difference in seconds -# elif ( defined (__Lynx__) || defined (__FreeBSD__) || defined (ACE_HAS_SUNOS4_GETTIMEOFDAY) ) && ( !defined (__linux__) ) +# elif defined (ACE_HAS_TIMEZONE_GETTIMEOFDAY) \ + && !defined (__linux__) \ + && !defined (__FreeBSD__) \ + && !defined (__NetBSD__) \ + && !defined (__OpenBSD__) + // The XPG/POSIX specification does not require gettimeofday to + // set the timezone struct (it leaves the behavior of passing a + // non-null struct undefined). We know gettimeofday() on Linux + // *BSD systems does not set the timezone, so we avoid using it + // and use the global variable <timezone> instead. + // + // @todo It would be better if we had a feature test macro that + // could be used instead of a list of operating systems. long result = 0; struct timeval time; struct timezone zone; ACE_UNUSED_ARG (result); ACE_OSCALL (::gettimeofday (&time, &zone), int, -1, result); return zone.tz_minuteswest * 60; -# else /* __Lynx__ || __FreeBSD__ ... */ -# if defined (__linux__) - // Under Linux, gettimeofday() does not correctly set the timezone - // struct, so we should use the global variable <timezone>. - // However, it is initialized by tzset(). I assume other systems - // are the same (i.e., tzset() needs to be called to set - // <timezone>), but since no one is complaining, I will only make - // the change for Linux. +# else /* ACE_HAS_TIMEZONE_GETTIMEOFDAY */ + // The XPG/POSIX specification requires that tzset() be called to + // set the global variable <timezone>. ::tzset(); -# endif return timezone; -# endif /* __Lynx__ || __FreeBSD__ ... */ +# endif /* ACE_HAS_TIMEZONE_GETTIMEOFDAY */ #else ACE_NOTSUP_RETURN (0); #endif /* !ACE_HAS_WINCE && !VXWORKS && !ACE_PSOS */ |