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

Simon Marlow simonmarhaskell at gmail.com
Mon Apr 30 08:11:50 EDT 2007


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-POSIX.html

getPOSIXTime will do what you want.

Cheers,
	Simon


More information about the Haskell-Cafe mailing list