HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulehosc-0.21.1Haskell2010

Sound.Osc.Time

Osc related timing functions. Osc timestamps are 64-bit Ntp values, http://ntp.org/.

Contents
  1. Temporal types
  2. Time conversion
  3. Data.Time inter-operation.
  4. Clock operations
Synopsis
  • Packagehosc-0.21.1
  • Exports17
  • LanguageHaskell2010
  • LicenceGPL-3.0-only
  • SourceTime.hs

Temporal types

typetype Ntp64 = Word64

Type for binary (integeral) representation of a 64-bit Ntp timestamp (ie. ntpi). The Ntp epoch is January 1, 1900. Ntp v4 also includes a 128-bit format, which is not used by Osc.

typetype PosixReal = Double

Unix/Posix time in real-valued (fractional) form. The Unix/Posix epoch is January 1, 1970.

Time conversion

Convert an NtpReal timestamp to an Ntp64 timestamp.

Example1 expression
ntpr_to_ntpi 00
fmap ntpr_to_ntpi time
valuentp_posix_epoch_diff :: Num n => n

Difference (in seconds) between Ntp and Posix epochs.

Example1 expression
ntp_posix_epoch_diff / (24 * 60 * 60)25567.0
Example1 expression
25567 `div` 36570

Data.Time inter-operation.

Clock operations

realToFrac of Clock.Posix.getPOSIXTime

get_ct = getCurrentTimeAsPosix
get_pt = getPosixTimeAsPosix
(ct,pt) <- get_ct >>= \t0 -> get_pt >>= \t1 -> return (t0,t1)
print (pt - ct,pt - ct < 1e-5)