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.Unix

Contents

Description

A native implementation of Unix Time.

Synopsis

Timestamps

newtype UnixDate cal Source #

Days since Unix epoch.

Constructors

UnixDate Int32 

Instances

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

Methods

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

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

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

Methods

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

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

toConstr :: UnixDate cal -> Constr #

dataTypeOf :: UnixDate cal -> DataType #

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

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

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

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

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

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

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

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

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

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

Ord (UnixDate cal) Source # 

Methods

compare :: UnixDate cal -> UnixDate cal -> Ordering #

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

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

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

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

max :: UnixDate cal -> UnixDate cal -> UnixDate cal #

min :: UnixDate cal -> UnixDate cal -> UnixDate cal #

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

Associated Types

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

Methods

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

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

Storable (UnixDate cal) Source # 

Methods

sizeOf :: UnixDate cal -> Int #

alignment :: UnixDate cal -> Int #

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

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

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

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

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

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

NFData (UnixDate cal) Source # 

Methods

rnf :: UnixDate cal -> () #

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

newtype UnixDateTime cal Source #

Seconds since Unix epoch (excluding leap seconds).

Constructors

UnixDateTime Int64 

Instances

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

Methods

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

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

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

Methods

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

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

toConstr :: UnixDateTime cal -> Constr #

dataTypeOf :: UnixDateTime cal -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Associated Types

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

Methods

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

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

Storable (UnixDateTime cal) Source # 

Methods

sizeOf :: UnixDateTime cal -> Int #

alignment :: UnixDateTime cal -> Int #

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

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

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

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

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

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

NFData (UnixDateTime cal) Source # 

Methods

rnf :: UnixDateTime cal -> () #

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

data UnixDateTimeNanos cal Source #

Nanoseconds since Unix epoch (excluding leap seconds).

Constructors

UnixDateTimeNanos !Int64 !Int32 

Instances

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

Methods

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

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

toConstr :: UnixDateTimeNanos cal -> Constr #

dataTypeOf :: UnixDateTimeNanos cal -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Associated Types

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

Storable (UnixDateTimeNanos cal) Source # 
NFData (UnixDateTimeNanos cal) Source # 

Methods

rnf :: UnixDateTimeNanos cal -> () #

Random (UnixDateTimeNanos Gregorian) Source # 
Human (UnixDateTimeNanos Gregorian) Source # 
Math (UnixDateTimeNanos Gregorian) Nanos Source # 
Math (UnixDateTimeNanos Gregorian) Micros Source # 
Math (UnixDateTimeNanos Gregorian) Millis Source # 
Math (UnixDateTimeNanos Gregorian) Second Source # 
Math (UnixDateTimeNanos Gregorian) Minute Source # 
Math (UnixDateTimeNanos Gregorian) Hour Source # 
Math (UnixDateTimeNanos Gregorian) Day Source # 
type Rep (UnixDateTimeNanos cal) Source # 
type Rep (UnixDateTimeNanos cal) = D1 (MetaData "UnixDateTimeNanos" "Data.Time.Exts.Unix" "time-exts-3.0.4-6aNofC78vxVCCO7wkglvdF" False) (C1 (MetaCons "UnixDateTimeNanos" PrefixI False) ((:*:) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Int64)) (S1 (MetaSel (Nothing Symbol) SourceUnpack SourceStrict DecidedStrict) (Rec0 Int32))))
type Components (UnixDateTimeNanos Gregorian) Source # 

Create

createUnixDate :: Year -> Month Gregorian -> Day -> UnixDate Gregorian Source #

Create a Unix datestamp.

createUnixDateTime :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> UnixDateTime Gregorian Source #

Create a Unix timestamp.

createUnixDateTimeNanos :: Year -> Month Gregorian -> Day -> Hour -> Minute -> Second -> Nanos -> UnixDateTimeNanos Gregorian Source #

Create a Unix timestamp with nanosecond granularity.

Get

getCurrentUnixDate :: IO (UnixDate Gregorian) Source #

Get the current Unix datestamp from the system clock.

getCurrentUnixDateTime :: IO (UnixDateTime Gregorian) Source #

Get the current Unix timestamp from the system clock.

getCurrentUnixDateTimeNanos :: IO (UnixDateTimeNanos Gregorian) Source #

Get the current Unix timestamp with nanosecond granularity from the system clock.

Parse

parseUnixDate :: TimeLocale -> Format -> Text -> Either String (UnixDate Gregorian) Source #

Parse a Unix datestamp.

parseUnixDateTimeNanos :: TimeLocale -> Format -> Text -> Either String (UnixDateTimeNanos Gregorian) Source #

Parse a Unix timestamp with nanosecond granularity.