    {-# LINE 1 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
    -- #hide
    {-# LINE 2 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
    module Data.Time.Clock.CTimespec where

    {-# LINE 5 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}

    {-# LINE 7 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}

    {-# LINE 9 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
    import Foreign

    {-# LINE 13 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
    import Foreign.C

    {-# LINE 16 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}

    data CTimespec = MkCTimespec CTime CLong

    instance Storable CTimespec where
        sizeOf _ = (16)
    {-# LINE 21 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
        alignment _ = alignment (undefined :: CLong)
        peek p = do
            s  <- (\hsc_ptr -> peekByteOff hsc_ptr 0) p
    {-# LINE 24 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
            ns <- (\hsc_ptr -> peekByteOff hsc_ptr 8) p
    {-# LINE 25 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
            return (MkCTimespec s ns)
        poke p (MkCTimespec s ns) = do
            (\hsc_ptr -> pokeByteOff hsc_ptr 0) p s
    {-# LINE 28 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
            (\hsc_ptr -> pokeByteOff hsc_ptr 8) p ns
    {-# LINE 29 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}

    foreign import ccall unsafe "time.h clock_gettime"
        clock_gettime :: Int32 -> Ptr CTimespec -> IO CInt
    {-# LINE 32 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}

    -- | Get the current POSIX time from the system clock.
    getCTimespec :: IO CTimespec
    getCTimespec = alloca (\ptspec -> do
        throwErrnoIfMinus1_ "clock_gettime" $
            clock_gettime 0 ptspec
    {-# LINE 38 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}
        peek ptspec
        )

    {-# LINE 42 "libraries/time/lib/Data/Time/Clock/CTimespec.hsc" #-}