hosc-0.11: Haskell Open Sound Control

Sound.OpenSoundControl.Time

Contents

Description

Temporal representations and clock operations (read current time and pause thread).

Synopsis

Temporal types

type NTPi = Word64Source

Type for integer representation of NTP time.

data Time Source

Time is represented in either UTC or NTP form. The NTP form may be either integral or real.

Constructors

UTCr Double 
NTPr Double 
NTPi NTPi 

Instances

Eq Time 
Ord Time

Times can be ordered, avoid coercion if not required.

Read Time 
Show Time 

as_ntpi :: Time -> NTPiSource

Coerce Time to integral NTP form.

as_utcr :: Time -> DoubleSource

Coerce Time to real-valued UTC form.

ntpr_ntpi :: Double -> NTPiSource

Convert a real-valued NTP timestamp to an NTPi timestamp.

ntpi_ntpr :: NTPi -> DoubleSource

Convert an NTPi timestamp to a real-valued NTP timestamp.

utcr_ntpi :: Double -> NTPiSource

Convert a real-valued UTC timestamp to an NTPi timestamp.

ntpr_utcr :: Double -> DoubleSource

Convert a real-valued NTP timestamp to a real-valued UTC timestamp.

ntpi_utcr :: NTPi -> DoubleSource

Convert an NTPi timestamp to a real-valued UTC timestamp.

utc_base :: UTCTimeSource

The time at 1970-01-01:00:00:00.

immediately :: TimeSource

Constant indicating the bundle is to be executed immediately.

Clock operations

utcr :: IO DoubleSource

Read current real-valued UTC timestamp.

ntpi :: IO NTPiSource

Read current NTPi timestamp.

pauseThreadLimit :: DoubleSource

The pauseThread limit (in seconds). Values larger than this require a different thread delay mechanism, see sleepThread. The value is the number of microseconds in maxBound::Int.

pauseThread :: Double -> IO ()Source

Pause current thread for the indicated duration (in seconds), see pauseThreadLimit. Note also that this function does not attempt pauses less than 1e-4.

pauseThreadUntil :: Double -> IO ()Source

Pause current thread until the given real-valued UTC time, see pauseThreadLimit.

sleepThread :: Double -> IO ()Source

Sleep current thread for the indicated duration (in seconds). Divides long sleeps into parts smaller than pauseThreadLimit.

sleepThreadUntil :: Double -> IO ()Source

Sleep current thread until the given real-valued UTC time. Divides long sleeps into parts smaller than pauseThreadLimit.