Debian Codegraph @

Sound/Osc/Time/System.hs

raw symbols SCIP
1 -- | System time
2 module Sound.Osc.Time.System where
3
4 import Data.Int {- base -}
5 import Data.Word {- base -}
6
7 import qualified Data.Time.Clock.System as Clock.System {- time >= 1.8 -}
8
9 import qualified Sound.Osc.Time as Time {- hosc -}
10
11 {- | Get the system time, epoch start of 1970 UTC, leap-seconds ignored.
12 getSystemTime is typically much faster than getCurrentTime, however it is not available in Hugs.
13 -}
14 getSystemTimeAsNtpReal :: IO Time.NtpReal
15 getSystemTimeAsNtpReal = do
16 tm <- Clock.System.getSystemTime
17 return (fromIntegral (Clock.System.systemSeconds tm) + (fromIntegral (Clock.System.systemNanoseconds tm) * 1.0e-9))
18
19 -- | System time with fractional part in microseconds (us) instead of nanoseconds (ns).
20 getSystemTimeInMicroseconds :: IO (Int64, Word32)
21 getSystemTimeInMicroseconds = do
22 tm <- Clock.System.getSystemTime
23 let sec = Clock.System.systemSeconds tm
24 usec = Clock.System.systemNanoseconds tm `div` 1000
25 return (sec, usec)