Ticket #2930 (closed merge: fixed)
System.Time.formatCalendarTime: %s isn't the number of seconds since the Epoch
|Reported by:||wferi||Owned by:||igloo|
|Type of failure:||Difficulty:||Unknown|
|Test Case:||Blocked By:|
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)
$ 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.