HORIZON HASKELLDocslts/ghc-9.14.x3e2d5682026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · 3e2d568 · 2026-10-11

Moduletime-1.15GHC2021

Data.Time.Clock.POSIX

POSIX time, if you need to deal with timestamps and the like. Most people won't need this module.

You can use POSIXTime to obtain integer/word timestamps. For example:

import Data.Time
import Data.Time.Clock.POSIX
import Data.Int

nanosSinceEpoch :: UTCTime -> Int64
nanosSinceEpoch =
    floor . (1e9 *) . nominalDiffTimeToSeconds . utcTimeToPOSIXSeconds

main :: IO ()
main = do
    u <- getCurrentTime
    print $ nanosSinceEpoch u
  • 1 type
  • 6 values
  • Packagetime-1.15
  • Exports7
  • LanguageGHC2021
  • LicenceBSD-2-Clause
  • SourcePOSIX.hs