diff options
author | sof <unknown> | 2002-07-23 18:50:54 +0000 |
---|---|---|
committer | sof <unknown> | 2002-07-23 18:50:54 +0000 |
commit | f212d46aaa47695c99ca0f21a1ac91713268477f (patch) | |
tree | 33a27b00866abad7b28546803b62f069507a2d9d | |
parent | 5e3b441c21541093a6dfee8305213c4bc4eb2245 (diff) | |
download | haskell-f212d46aaa47695c99ca0f21a1ac91713268477f.tar.gz |
[project @ 2002-07-23 18:50:54 by sof]
gmtoff: MS CRT implementation of _tzset() (and _timezone) assumes that >0
represent positions west of the Prime Meridian. This module assumes the
opposite, so flip the sign of 'timezone' when compiling for mingw.
-rw-r--r-- | libraries/base/System/Time.hsc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libraries/base/System/Time.hsc b/libraries/base/System/Time.hsc index 6d8a800584..3df3091c25 100644 --- a/libraries/base/System/Time.hsc +++ b/libraries/base/System/Time.hsc @@ -348,6 +348,12 @@ foreign import ccall unsafe "timezone" timezone :: Ptr CLong gmtoff x = do dst <- (#peek struct tm,tm_isdst) x tz <- peek timezone +#if defined(mingw32_TARGET_OS) + -- According to the MSVC documentation for _tzset, _timezone is > 0 + -- for locations west of the Prime Meridian. Code elsewhere in this + -- module assume that >0 gmt offsets means east, so flip the sign. + tz <- return (-tz) +#endif if dst then return (fromIntegral tz - 3600) else return tz # endif /* ! HAVE_ALTZONE */ #endif /* ! HAVE_TM_ZONE */ |