-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Unix time parser/formatter and utilities
--   
--   Fast parser/formatter/utilities for Unix time
@package unix-time
@version 0.1.2

module Data.UnixTime

-- | Data structure for Unix time.
data UnixTime
UnixTime :: {-# UNPACK #-} !CTime -> {-# UNPACK #-} !Int32 -> UnixTime

-- | Seconds from 1st Jan 1970
utSeconds :: UnixTime -> {-# UNPACK #-} !CTime

-- | Micro seconds (i.e. 10^(-6))
utMicroSeconds :: UnixTime -> {-# UNPACK #-} !Int32

-- | Getting <a>UnixTime</a> from OS.
getUnixTime :: IO UnixTime

-- | Parsing <a>ByteString</a> to <a>UnixTime</a> interpreting as
--   localtime. Zone in <a>Format</a> (%Z or %z) would be ignored. This is
--   a wrapper for strptime_l().
parseUnixTime :: Format -> ByteString -> UnixTime

-- | Parsing <a>ByteString</a> to <a>UnixTime</a> interpreting as GMT. Zone
--   in <a>Format</a> (%Z or %z) would be ignored. This is a wrapper for
--   strptime_l().
parseUnixTimeGMT :: Format -> ByteString -> UnixTime

-- | Formatting <a>UnixTime</a> to <a>ByteString</a> in local time. This is
--   a wrapper for strftime_l().
formatUnixTime :: Format -> UnixTime -> ByteString

-- | Formatting <a>UnixTime</a> to <a>ByteString</a> in GMT. This is a
--   wrapper for strftime_l().
formatUnixTimeGMT :: Format -> UnixTime -> ByteString

-- | Format of the strptime()/strftime() style.
type Format = ByteString

-- | Format for web (RFC 2616). This should be used with
--   <a>formatUnixTimeGMT</a>.
webDateFormat :: Format

-- | Format for e-mail (RFC 5322). This should be used with
--   <a>formatUnixTime</a>.
mailDateFormat :: Format

-- | Data structure for UnixTime diff.
data UnixDiffTime

-- | Calculating difference between two <a>UnixTime</a>.
diffUnixTime :: UnixTime -> UnixTime -> UnixDiffTime

-- | Adding difference to <a>UnixTime</a>.
addUnixDiffTime :: UnixTime -> UnixDiffTime -> UnixTime

-- | Creating difference from seconds.
secondsToUnixDiffTime :: Integral a => a -> UnixDiffTime

-- | Creating difference from micro seconds.
microSecondsToUnixDiffTime :: Integral a => a -> UnixDiffTime

-- | From <a>EpochTime</a> to <a>UnixTime</a> setting <a>utMicroSeconds</a>
--   to 0.
fromEpochTime :: EpochTime -> UnixTime

-- | From <a>UnixTime</a> to <a>EpochTime</a> ignoring
--   <a>utMicroSeconds</a>.
toEpochTime :: UnixTime -> EpochTime

-- | From <a>ClockTime</a> to <a>UnixTime</a>.
fromClockTime :: ClockTime -> UnixTime

-- | From <a>UnixTime</a> to <a>ClockTime</a>.
toClockTime :: UnixTime -> ClockTime
