{-# LINE 1 "Data/UnixTime/Types.hsc" #-}
module Data.UnixTime.Types where
import Control.Applicative ((<$>), (<*>))
import Data.ByteString
import Data.ByteString.Char8 ()
import Data.Int
{-# LINE 10 "Data/UnixTime/Types.hsc" #-}
import Foreign.C.Types
import Foreign.Storable
{-# LINE 13 "Data/UnixTime/Types.hsc" #-}
import Data.Binary
{-# LINE 15 "Data/UnixTime/Types.hsc" #-}
data UnixTime = UnixTime {
utSeconds :: {-# UNPACK #-} !CTime
, utMicroSeconds :: {-# UNPACK #-} !Int32
} deriving (Eq,Ord,Show)
instance Storable UnixTime where
sizeOf _ = ((16))
{-# LINE 39 "Data/UnixTime/Types.hsc" #-}
alignment _ = (8)
{-# LINE 40 "Data/UnixTime/Types.hsc" #-}
{-# LINE 64 "Data/UnixTime/Types.hsc" #-}
peek ptr = UnixTime
<$> ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr
{-# LINE 66 "Data/UnixTime/Types.hsc" #-}
<*> ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr
{-# LINE 67 "Data/UnixTime/Types.hsc" #-}
poke ptr ut = do
((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr (utSeconds ut)
{-# LINE 69 "Data/UnixTime/Types.hsc" #-}
((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr (utMicroSeconds ut)
{-# LINE 70 "Data/UnixTime/Types.hsc" #-}
{-# LINE 71 "Data/UnixTime/Types.hsc" #-}
{-# LINE 73 "Data/UnixTime/Types.hsc" #-}
instance Binary UnixTime where
put (UnixTime (CTime sec) msec) = do
put sec
put msec
get = UnixTime <$> (CTime `fmap` get) <*> get
{-# LINE 79 "Data/UnixTime/Types.hsc" #-}
type Format = ByteString
data UnixDiffTime = UnixDiffTime {
udtSeconds :: {-# UNPACK #-} !CTime
, udtMicroSeconds :: {-# UNPACK #-} !Int32
} deriving (Eq,Ord,Show)