#2930: System.Time.formatCalendarTime: %s isn't the number of seconds since the
Epoch
-------------------+--------------------------------------------------------
Reporter: wferi | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries (old-time)
Version: 6.8.2 | Severity: normal
Keywords: | Testcase:
Os: Linux | Architecture: x86
-------------------+--------------------------------------------------------
`formatCalendarTime` references strftime(3), and `man strftime` says
that `%s` is "the number of seconds since the Epoch, that is, since
1970-01-01 00:00:00 UTC."
However, under GHC 6.8.2 it is restricted to the 00-59 range, as the
following demonstrates.
`epoch.hs` is the following:
{{{
import System.Time
main = putStrLn $ formatCalendarTime undefined "%Y-%m-%d %T (%s)"
(toUTCTime $ TOD 62 0)
}}}
And now:
{{{
$ runghc epoch.hs
1970-01-01 00:01:02 (02)
$ date --utc -d @62 +"%Y-%m-%d %T (%s)"
1970-01-01 00:01:02 (62)
}}}
I think ''GNU date'' is right, ''System.Time'' is wrong.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2930>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs