time-exts-3.0.4: Yet another time library

Copyright2013-2017 Enzo Haussecker
LicenseBSD3
MaintainerEnzo Haussecker <enzo@sovereign.io>
StabilityStable
Safe HaskellNone
LanguageHaskell2010

Data.Time.Exts.UTC

Contents

Description

A native implementation of Coordinated Universal Time.

Synopsis

Timestamps

newtype UTCDate cal Source #

Days since Unix epoch.

Constructors

UTCDate (UnixDate cal) 

Instances

Bounded (UTCDate Gregorian) Source # 
Enum (UTCDate Gregorian) Source # 
Eq (UTCDate cal) Source # 

Methods

(==) :: UTCDate cal -> UTCDate cal -> Bool #

(/=) :: UTCDate cal -> UTCDate cal -> Bool #

Typeable Calendar cal => Data (UTCDate cal) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCDate cal -> c (UTCDate cal) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (UTCDate cal) #

toConstr :: UTCDate cal -> Constr #

dataTypeOf :: UTCDate cal -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (UTCDate cal)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (UTCDate cal)) #

gmapT :: (forall b. Data b => b -> b) -> UTCDate cal -> UTCDate cal #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCDate cal -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCDate cal -> r #

gmapQ :: (forall d. Data d => d -> u) -> UTCDate cal -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCDate cal -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCDate cal -> m (UTCDate cal) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDate cal -> m (UTCDate cal) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDate cal -> m (UTCDate cal) #

Ord (UTCDate cal) Source # 

Methods

compare :: UTCDate cal -> UTCDate cal -> Ordering #

(<) :: UTCDate cal -> UTCDate cal -> Bool #

(<=) :: UTCDate cal -> UTCDate cal -> Bool #

(>) :: UTCDate cal -> UTCDate cal -> Bool #

(>=) :: UTCDate cal -> UTCDate cal -> Bool #

max :: UTCDate cal -> UTCDate cal -> UTCDate cal #

min :: UTCDate cal -> UTCDate cal -> UTCDate cal #

Show (UTCDate Gregorian) Source # 
Generic (UTCDate cal) Source # 

Associated Types

type Rep (UTCDate cal) :: * -> * #

Methods

from :: UTCDate cal -> Rep (UTCDate cal) x #

to :: Rep (UTCDate cal) x -> UTCDate cal #

Storable (UTCDate cal) Source # 

Methods

sizeOf :: UTCDate cal -> Int #

alignment :: UTCDate cal -> Int #

peekElemOff :: Ptr (UTCDate cal) -> Int -> IO (UTCDate cal) #

pokeElemOff :: Ptr (UTCDate cal) -> Int -> UTCDate cal -> IO () #

peekByteOff :: Ptr b -> Int -> IO (UTCDate cal) #

pokeByteOff :: Ptr b -> Int -> UTCDate cal -> IO () #

peek :: Ptr (UTCDate cal) -> IO (UTCDate cal) #

poke :: Ptr (UTCDate cal) -> UTCDate cal -> IO () #

NFData (UTCDate cal) Source # 

Methods

rnf :: UTCDate cal -> () #

Random (UTCDate Gregorian) Source # 
Human (UTCDate Gregorian) Source # 
Math (UTCDate Gregorian) Day Source # 
type Rep (UTCDate cal) Source # 
type Rep (UTCDate cal) = D1 (MetaData "UTCDate" "Data.Time.Exts.UTC" "time-exts-3.0.4-6aNofC78vxVCCO7wkglvdF" True) (C1 (MetaCons "UTCDate" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (UnixDate cal))))
type Components (UTCDate Gregorian) Source # 

newtype UTCDateTime cal Source #

Seconds since Unix epoch (including leap seconds).

Constructors

UTCDateTime Int64 

Instances

Bounded (UTCDateTime Gregorian) Source # 
Enum (UTCDateTime Gregorian) Source # 
Eq (UTCDateTime cal) Source # 

Methods

(==) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

(/=) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

Typeable Calendar cal => Data (UTCDateTime cal) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCDateTime cal -> c (UTCDateTime cal) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (UTCDateTime cal) #

toConstr :: UTCDateTime cal -> Constr #

dataTypeOf :: UTCDateTime cal -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (UTCDateTime cal)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (UTCDateTime cal)) #

gmapT :: (forall b. Data b => b -> b) -> UTCDateTime cal -> UTCDateTime cal #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCDateTime cal -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCDateTime cal -> r #

gmapQ :: (forall d. Data d => d -> u) -> UTCDateTime cal -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCDateTime cal -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCDateTime cal -> m (UTCDateTime cal) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDateTime cal -> m (UTCDateTime cal) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDateTime cal -> m (UTCDateTime cal) #

Ord (UTCDateTime cal) Source # 

Methods

compare :: UTCDateTime cal -> UTCDateTime cal -> Ordering #

(<) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

(<=) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

(>) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

(>=) :: UTCDateTime cal -> UTCDateTime cal -> Bool #

max :: UTCDateTime cal -> UTCDateTime cal -> UTCDateTime cal #

min :: UTCDateTime cal -> UTCDateTime cal -> UTCDateTime cal #

Show (UTCDateTime Gregorian) Source # 
Generic (UTCDateTime cal) Source # 

Associated Types

type Rep (UTCDateTime cal) :: * -> * #

Methods

from :: UTCDateTime cal -> Rep (UTCDateTime cal) x #

to :: Rep (UTCDateTime cal) x -> UTCDateTime cal #

Storable (UTCDateTime cal) Source # 

Methods

sizeOf :: UTCDateTime cal -> Int #

alignment :: UTCDateTime cal -> Int #

peekElemOff :: Ptr (UTCDateTime cal) -> Int -> IO (UTCDateTime cal) #

pokeElemOff :: Ptr (UTCDateTime cal) -> Int -> UTCDateTime cal -> IO () #

peekByteOff :: Ptr b -> Int -> IO (UTCDateTime cal) #

pokeByteOff :: Ptr b -> Int -> UTCDateTime cal -> IO () #

peek :: Ptr (UTCDateTime cal) -> IO (UTCDateTime cal) #

poke :: Ptr (UTCDateTime cal) -> UTCDateTime cal -> IO () #

NFData (UTCDateTime cal) Source # 

Methods

rnf :: UTCDateTime cal -> () #

Random (UTCDateTime Gregorian) Source # 
Human (UTCDateTime Gregorian) Source # 
Math (UTCDateTime Gregorian) Second Source # 
type Rep (UTCDateTime cal) Source # 
type Rep (UTCDateTime cal) = D1 (MetaData "UTCDateTime" "Data.Time.Exts.UTC" "time-exts-3.0.4-6aNofC78vxVCCO7wkglvdF" True) (C1 (MetaCons "UTCDateTime" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int64)))
type Components (UTCDateTime Gregorian) Source # 

data UTCDateTimeNanos cal Source #

Nanoseconds since Unix epoch (including leap seconds).

Constructors

UTCDateTimeNanos !Int64 !Int32 

Instances

Bounded (UTCDateTimeNanos Gregorian) Source # 
Eq (UTCDateTimeNanos cal) Source # 
Typeable Calendar cal => Data (UTCDateTimeNanos cal) Source # 

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> UTCDateTimeNanos cal -> c (UTCDateTimeNanos cal) #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (UTCDateTimeNanos cal) #

toConstr :: UTCDateTimeNanos cal -> Constr #

dataTypeOf :: UTCDateTimeNanos cal -> DataType #

dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (UTCDateTimeNanos cal)) #

dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (UTCDateTimeNanos cal)) #

gmapT :: (forall b. Data b => b -> b) -> UTCDateTimeNanos cal -> UTCDateTimeNanos cal #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> UTCDateTimeNanos cal -> r #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> UTCDateTimeNanos cal -> r #

gmapQ :: (forall d. Data d => d -> u) -> UTCDateTimeNanos cal -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> UTCDateTimeNanos cal -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> UTCDateTimeNanos cal -> m (UTCDateTimeNanos cal) #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDateTimeNanos cal -> m (UTCDateTimeNanos cal) #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> UTCDateTimeNanos cal -> m (UTCDateTimeNanos cal) #

Ord (UTCDateTimeNanos cal) Source # 
Show (UTCDateTimeNanos Gregorian) Source # 
Generic (UTCDateTimeNanos cal) Source # 

Associated Types

type Rep (UTCDateTimeNanos cal) :: * -> * #

Storable (UTCDateTimeNanos cal) Source # 
NFData (UTCDateTimeNanos cal) Source # 

Methods

rnf :: UTCDateTimeNanos cal -> () #

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 Rep (UTCDateTimeNanos cal) = D1 (MetaData "UTCDateTimeNanos" "Data.Time.Exts.UTC" "time-exts-3.0.4-6aNofC78vxVCCO7wkglvdF" False) (C1 (MetaCons "UTCDateTimeNanos" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Int32))))
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.

parseUTCDateTimeNanos :: TimeLocale -> Format -> Text -> Either String (UTCDateTimeNanos Gregorian) Source #

Parse a UTC timestamp with nanosecond granularity.