[Haskell-cafe] Getting the number of seconds since epoch from System.Time.ClockTime

Rich Neswold rich.neswold at gmail.com
Tue May 1 14:00:28 EDT 2007


On 4/26/07, Martin Percossi <haskell-cafe at martinpercossi.com> wrote:
> 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 at neswold.homeunix.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070501/9af9d3aa/attachment.htm


More information about the Haskell-Cafe mailing list