Getting the number of seconds since epoch from System.Time.ClockTime

Hello haskell-cafe, In System.Time, data ClockTime = TOD Integer Integer , where the first integer represents the number of seconds since epoch, and the other represents the number of picoseconds. Is there a way of retrieving the first part? (In Haskell 98, the ClockTime type is abstract). TIA Martin My music: http://www.youtube.com/profile?user=thetonegrove

Martin Percossi wrote:
Hello haskell-cafe,
In System.Time,
data ClockTime = TOD Integer Integer
, where the first integer represents the number of seconds since epoch, and the other represents the number of picoseconds. Is there a way of retrieving the first part? (In Haskell 98, the ClockTime type is abstract).
Better to use the new time package, in particular Data.Time.Clock.POSIX: http://www.haskell.org/ghc/docs/latest/html/libraries/time/Data-Time-Clock-P... getPOSIXTime will do what you want. Cheers, Simon

On 4/26/07, Martin Percossi
In System.Time,
data ClockTime = TOD Integer Integer
, where the first integer represents the number of seconds since epoch, and the other represents the number of picoseconds. Is there a way of retrieving the first part? (In Haskell 98, the ClockTime type is abstract).
I usually pattern match the constructor: do { TOD epoch _ <- getClockTime ; putStrLn $ "epoch is " ++ show epoch } -- Rich AIM : rnezzy ICQ : 174908475 Jabber: rich@neswold.homeunix.net
participants (3)
-
Martin Percossi
-
Rich Neswold
-
Simon Marlow