module Sound.Osc.Time.System where
import Data.Int
import Data.Word
import qualified Data.Time.Clock.System as Clock.System
import qualified Sound.Osc.Time as Time
getSystemTimeAsNtpReal :: IO Time.NtpReal
getSystemTimeAsNtpReal :: IO NtpReal
getSystemTimeAsNtpReal = do
tm <- IO SystemTime
Clock.System.getSystemTime
return (fromIntegral (Clock.System.systemSeconds tm) + (fromIntegral (Clock.System.systemNanoseconds tm) * 1.0e-9))
getSystemTimeInMicroseconds :: IO (Int64, Word32)
getSystemTimeInMicroseconds :: IO (Int64, Word32)
getSystemTimeInMicroseconds = do
tm <- IO SystemTime
Clock.System.getSystemTime
let sec = SystemTime -> Int64
Clock.System.systemSeconds SystemTime
tm
usec = SystemTime -> Word32
Clock.System.systemNanoseconds SystemTime
tm Word32 -> Word32 -> Word32
forall a. Integral a => a -> a -> a
`div` Word32
1000
return (sec, usec)