Ticket #1486 (closed bug: fixed)
utcToLocalTime converting in the wrong direction on Windows
| Reported by: | Olivier Boudry | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Not GHC |
| Component: | libraries (other) | Version: | 6.6.1 |
| Keywords: | Cc: | ashley@… | |
| Operating System: | Windows | Architecture: | x86 |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description (last modified by igloo) (diff)
I found a strange UTC to Local Time conversion bug on the Windows version of GHC 6.6.1.
Code to reproduce it:
import Monad
import Data.Time
import Locale
main = do
t <- (liftM2 utcToLocalTime) getCurrentTimeZone getCurrentTime
let s = formatTime defaultTimeLocale "%r" t
putStrLn s
z <- (liftM timeZoneName) getCurrentTimeZone
putStrLn z
Running this program around 04:35 PM I get the following results
On Linux (a recent Ubuntu with GHC 6.6.1 compiled from source)
04:35:48 PM EDT
On Windows (GHC 6.6.1 from installer) I get
12:36:04 AM Eastern Daylight Time
Looks like the Windows version is counting in the wrong direction. I made some tests in GHCi on both machines an get this:
On Windows:
Prelude> :m Monad Data.Time Locale Prelude Locale Data.Time Monad> z <- getCurrentTimeZone Eastern Daylight Time Prelude Locale Data.Time Monad> timeZoneMinutes z 240
On Linux: (same commands)
Prelude Locale Data.Time Monad> timeZoneMinutes z -240
Cheers,
Olivier.
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

