[GHC] #1486: utcToLocalTime converting in the wrong direction on Windows

GHC trac at galois.com
Sat Jul 7 06:52:40 EDT 2007


#1486: utcToLocalTime converting in the wrong direction on Windows
----------------------------------+-----------------------------------------
    Reporter:  Olivier Boudry     |        Owner:         
        Type:  bug                |       Status:  new    
    Priority:  normal             |    Milestone:         
   Component:  libraries (other)  |      Version:  6.6.1  
    Severity:  normal             |   Resolution:         
    Keywords:                     |   Difficulty:  Unknown
          Os:  Windows            |     Testcase:         
Architecture:  x86                |  
----------------------------------+-----------------------------------------
Old description:

> 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.

New description:

 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1486>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
-------------- next part --------------
_______________________________________________
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs at haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


More information about the Glasgow-haskell-bugs mailing list