Copyright | 2013-2017 Enzo Haussecker |
---|---|
License | BSD3 |
Maintainer | Enzo Haussecker <enzo@sovereign.io> |
Stability | Stable |
Safe Haskell | None |
Language | Haskell2010 |
A native implementation of Coordinated Universal Time.
- newtype UTCDate cal = UTCDate (UnixDate cal)
- newtype UTCDateTime cal = UTCDateTime Int64
- data UTCDateTimeNanos cal = UTCDateTimeNanos !Int64 !Int32
- createUTCDate :: Year -> Month Gregorian -> Day -> UTCDate Gregorian
- createUTCDateTime :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> UTCDateTime Gregorian
- createUTCDateTimeNanos :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> Nanos -> UTCDateTimeNanos Gregorian
- getCurrentUTCDate :: IO (UTCDate Gregorian)
- getCurrentUTCDateTime :: IO (UTCDateTime Gregorian)
- getCurrentUTCDateTimeNanos :: IO (UTCDateTimeNanos Gregorian)
- parseUTCDate :: TimeLocale -> Format -> Text -> Either String (UTCDate Gregorian)
- parseUTCDateTime :: TimeLocale -> Format -> Text -> Either String (UTCDateTime Gregorian)
- parseUTCDateTimeNanos :: TimeLocale -> Format -> Text -> Either String (UTCDateTimeNanos Gregorian)
Timestamps
Days since Unix epoch.
Bounded (UTCDate Gregorian) Source # | |
Enum (UTCDate Gregorian) Source # | |
Eq (UTCDate cal) Source # | |
Typeable Calendar cal => Data (UTCDate cal) Source # | |
Ord (UTCDate cal) Source # | |
Show (UTCDate Gregorian) Source # | |
Generic (UTCDate cal) Source # | |
Storable (UTCDate cal) Source # | |
NFData (UTCDate cal) Source # | |
Random (UTCDate Gregorian) Source # | |
Human (UTCDate Gregorian) Source # | |
Math (UTCDate Gregorian) Day Source # | |
type Rep (UTCDate cal) Source # | |
type Components (UTCDate Gregorian) Source # | |
newtype UTCDateTime cal Source #
Seconds since Unix epoch (including leap seconds).
Bounded (UTCDateTime Gregorian) Source # | |
Enum (UTCDateTime Gregorian) Source # | |
Eq (UTCDateTime cal) Source # | |
Typeable Calendar cal => Data (UTCDateTime cal) Source # | |
Ord (UTCDateTime cal) Source # | |
Show (UTCDateTime Gregorian) Source # | |
Generic (UTCDateTime cal) Source # | |
Storable (UTCDateTime cal) Source # | |
NFData (UTCDateTime cal) Source # | |
Random (UTCDateTime Gregorian) Source # | |
Human (UTCDateTime Gregorian) Source # | |
Math (UTCDateTime Gregorian) Second Source # | |
type Rep (UTCDateTime cal) Source # | |
type Components (UTCDateTime Gregorian) Source # | |
data UTCDateTimeNanos cal Source #
Nanoseconds since Unix epoch (including leap seconds).
Bounded (UTCDateTimeNanos Gregorian) Source # | |
Eq (UTCDateTimeNanos cal) Source # | |
Typeable Calendar cal => Data (UTCDateTimeNanos cal) Source # | |
Ord (UTCDateTimeNanos cal) Source # | |
Show (UTCDateTimeNanos Gregorian) Source # | |
Generic (UTCDateTimeNanos cal) Source # | |
Storable (UTCDateTimeNanos cal) Source # | |
NFData (UTCDateTimeNanos cal) Source # | |
Random (UTCDateTimeNanos Gregorian) Source # | |
Human (UTCDateTimeNanos Gregorian) Source # | |
Math (UTCDateTimeNanos Gregorian) Nanos Source # | |
Math (UTCDateTimeNanos Gregorian) Micros Source # | |
Math (UTCDateTimeNanos Gregorian) Millis Source # | |
Math (UTCDateTimeNanos Gregorian) Second Source # | |
type Rep (UTCDateTimeNanos cal) Source # | |
type Components (UTCDateTimeNanos Gregorian) Source # | |
Create
createUTCDate :: Year -> Month Gregorian -> Day -> UTCDate Gregorian Source #
Create a UTC datestamp.
createUTCDateTime :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> UTCDateTime Gregorian Source #
Create a UTC timestamp.
createUTCDateTimeNanos :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> Nanos -> UTCDateTimeNanos Gregorian Source #
Create a UTC timestamp with nanosecond granularity.
Get
getCurrentUTCDate :: IO (UTCDate Gregorian) Source #
Get the current UTC datestamp from the system clock.
getCurrentUTCDateTime :: IO (UTCDateTime Gregorian) Source #
Get the current UTC timestamp from the system clock.
getCurrentUTCDateTimeNanos :: IO (UTCDateTimeNanos Gregorian) Source #
Get the current UTC timestamp with nanosecond granularity from the system clock. Any observed leap second will be spread out over the day to ensure nanosecond continuity at midnight.
Parse
parseUTCDate :: TimeLocale -> Format -> Text -> Either String (UTCDate Gregorian) Source #
Parse a UTC datestamp.
parseUTCDateTime :: TimeLocale -> Format -> Text -> Either String (UTCDateTime Gregorian) Source #
Parse a UTC timestamp.
parseUTCDateTimeNanos :: TimeLocale -> Format -> Text -> Either String (UTCDateTimeNanos Gregorian) Source #
Parse a UTC timestamp with nanosecond granularity.