HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulehosc-0.20Haskell2010

Sound.Osc.Time

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

  • 3 types
  • 14 values
  • Packagehosc-0.20
  • Exports17
  • LanguageHaskell2010
  • LicenceGPL-3.0-only
  • SourceTime.hs

Temporal types

3 declarations
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 NtpReal = Double
#

Ntp time in real-valued (fractional) form.

typetype PosixReal = Double
#

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

Time conversion

9 declarations
valuentpr_to_ntpi :: NtpReal -> Ntp64
#

Convert an NtpReal timestamp to an Ntp64 timestamp.

ntpr_to_ntpi 0 == 0
fmap ntpr_to_ntpi time
valuentp_posix_epoch_diff :: Num n => n
#

Difference (in seconds) between Ntp and Posix epochs.

ntp_posix_epoch_diff / (24 * 60 * 60) == 25567
25567 `div` 365 == 70

Data.Time inter-operation.

2 declarations
valueposix_epoch :: UTCTime
#

The time at 1970-01-01:00:00:00 which is the Unix/Posix epoch.

Clock operations

3 declarations

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)