Popularity
4.5
Declining
Activity
0.0
Stable
8
3
0
Monthly Downloads: 18
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags:
Time
duration alternatives and similar packages
Based on the "Time" category.
Alternatively, view duration alternatives based on common mentions on social networks and blogs.
-
timezone-olson
A pure Haskell parser and renderer for binary Olson timezone files -
time-locale-compat
Compatibility of TimeLocale between old-locale and time-1.5 -
fixed-timestep
Pure Haskell library to run an action repeatedly, a specific amount of times per second. -
flick-duration
Provides Duration; a type to contain amounts of time
Access the most powerful time series database as a service
Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.
Promo
www.influxdata.com
Do you think we are missing an alternative of duration or a related project?
README
duration
A tiny compile-time time utility library, inspired by zeit/ms.
Examples
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeApplications #-}
module Main where
import Data.Time.Clock (DiffTime, NominalDiffTime)
import Data.Time.Clock.Duration (t, s, ms, µs, ns, ps)
main :: IO ()
main = do
print @DiffTime [t| 1 day |] -- 86400s
print @DiffTime [t| 2h |] -- 7200s
print @DiffTime [t| -1m |] -- -60s
print @NominalDiffTime [s| 1 |] -- 1s
print @NominalDiffTime [ms| 1 |] -- 0.001s
print @NominalDiffTime [µs| 1 |] -- 0.000001s
print @NominalDiffTime [ns| 1 |] -- 0.000000001s
print @NominalDiffTime [ps| 1 |] -- 0.000000000001s
print @Int [s| 2 days |] -- 172800
print @Integer [ms| 5s |] -- 5000
print @Double [µs| 2min |] -- 1.2e8
print @Float [ns| -1 sec |] -- -1.0e9
print @Rational [ps| 10ms |] -- 10000000000 % 1