| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Core.System.External
Contents
Description
Re-exports of dependencies from various external libraries.
Synopsis
- newtype TimeStamp = TimeStamp {
- unTimeStamp :: Int64
- getCurrentTimeNanoseconds :: IO TimeStamp
Time
from Chrono.TimeStamp
Re-exported from Chrono.TimeStamp in chronologique:
Number of nanoseconds since the Unix epoch.
The Show instance displays the TimeStamp as seconds with the nanosecond precision expressed as a decimal amount after the interger, ie:
>>>t <- getCurrentTimeNanoseconds>>>show t2014-07-31T23:09:35.274387031Z
However this doesn't change the fact the underlying representation counts nanoseconds since epoch:
>>>show $ unTimeStamp t1406848175274387031
There is a Read instance that is reasonably accommodating.
>>>read "2014-07-31T13:05:04.942089001Z" :: TimeStamp2014-07-31T13:05:04.942089001Z
>>>read "1406811904.942089001" :: TimeStamp2014-07-31T13:05:04.942089001Z
>>>read "1406811904" :: TimeStamp2014-07-31T13:05:04.000000000Z
In case you're wondering, the valid range of nanoseconds that fits into the underlying Int64 is:
>>>show $ minBound :: TimeStamp1677-09-21T00:12:43.145224192Z
>>>show $ maxBound :: TimeStamp2262-04-11T23:47:16.854775807Z
so in a quarter millenium's time, yes, you'll have the Y2262 Problem. Haskell code from today will, of course, still be running, so in the mid Twenty-Third century you will need to replace this implementation with something else.
Constructors
| TimeStamp | |
Fields
| |
Instances
getCurrentTimeNanoseconds :: IO TimeStamp #
Get the current system time, expressed as a TimeStamp (which is to
say, number of nanoseconds since the Unix epoch).