System.Time.formatCalendarTime: %s isn't the number of seconds since the Epoch
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.8.2 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | libraries/old-time |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |