chronologique-0.3.0.1: Time to manipulate time

Safe HaskellNone
LanguageHaskell2010

Chrono.TimeStamp

Synopsis

Documentation

newtype TimeStamp Source #

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 t
2014-07-31T23:09:35.274387031Z

However this doesn't change the fact the underlying representation counts nanoseconds since epoch:

>>> show $ unTimeStamp t
1406848175274387031

There is a Read instance that is reasonably accommodating.

>>> read "2014-07-31T13:05:04.942089001Z" :: TimeStamp
2014-07-31T13:05:04.942089001Z
>>> read "1406811904.942089001" :: TimeStamp
2014-07-31T13:05:04.942089001Z
>>> read "1406811904" :: TimeStamp
2014-07-31T13:05:04.000000000Z

In case you're wondering, the valid range of nanoseconds that fits into the underlying Int64 is:

>>> show $ minBound :: TimeStamp
1677-09-21T00:12:43.145224192Z
>>> show $ maxBound :: TimeStamp
2262-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

Bounded TimeStamp Source # 
Enum TimeStamp Source # 
Eq TimeStamp Source # 
Integral TimeStamp Source # 
Num TimeStamp Source # 
Ord TimeStamp Source # 
Read TimeStamp Source # 
Real TimeStamp Source # 
Show TimeStamp Source # 
Timeable TimeStamp Source # 
Time TimeStamp Source # 
Unbox TimeStamp Source # 
Vector Vector TimeStamp Source # 
MVector MVector TimeStamp Source # 
data Vector TimeStamp Source # 
data MVector s TimeStamp Source # 

getCurrentTimeNanoseconds :: IO TimeStamp Source #

Get the current system time, expressed as a TimeStamp (which is to say, number of nanoseconds since the Unix epoch).

data ISO8601_Precise Source #

Format string describing full (nanosecond) precision ISO8601 time,

2014-07-31T23:09:35.274387019Z

Constructors

ISO8601_Precise