{-# LINE 1 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
module Sound.ALSA.Sequencer.Marshal.RealTime where
{-# LINE 2 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}


{-# LINE 4 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}

{-# LINE 5 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}

import qualified Sound.ALSA.Sequencer.Utility as U

import qualified Data.Word as Word
import Foreign.Storable
          (Storable, sizeOf, alignment, peek, poke, pokeByteOff, peekByteOff, )


data T = Cons
   { secs :: ! Word.Word32
{-# LINE 15 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
   , nano :: ! Word.Word32
{-# LINE 16 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
   }
   deriving (Eq)

instance Show T where
   showsPrec prec (Cons s n) =
      U.showsRecord prec "RealTime" [U.showsField s, U.showsField n]


instance Storable T where
  sizeOf _    = (8)
{-# LINE 26 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
  alignment _ = (4)
{-# LINE 27 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
  peek p      = do s <- (\hsc_ptr -> peekByteOff hsc_ptr 0) p
{-# LINE 28 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
                   n <- (\hsc_ptr -> peekByteOff hsc_ptr 4) p
{-# LINE 29 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
                   return Cons { secs = s, nano = n }
  poke p v    = (\hsc_ptr -> pokeByteOff hsc_ptr 0) p (secs v)
{-# LINE 31 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}
             >> (\hsc_ptr -> pokeByteOff hsc_ptr 4) p (nano v)
{-# LINE 32 "src/Sound/ALSA/Sequencer/Marshal/RealTime.hsc" #-}