/
Time.purs
31 lines (23 loc) · 921 Bytes
/
Time.purs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
-- | A collection of units for durations of time.
module Data.Units.Time where
import Data.Units (DerivedUnit, makeNonStandard)
import Data.Units.SI
import Prelude ((*), (+))
-- | Unit of time, *1 min = 60 sec*.
minute ∷ DerivedUnit
minute = makeNonStandard "minute" "min" 60.0 second
-- | Unit of time, *1 hour = 60 min*.
hour ∷ DerivedUnit
hour = makeNonStandard "hour" "h" 3600.0 second
-- | Unit of time, *1 day = 24 hour*.
day ∷ DerivedUnit
day = makeNonStandard "day" "d" (24.0 * 3600.0) second
-- | Unit of time, *1 week = 7 days*.
week ∷ DerivedUnit
week = makeNonStandard "week" "week" (7.0 * 24.0 * 3600.0) second
-- | Unit of time, *1 month = 30 days + 10 hours*.
month ∷ DerivedUnit
month = makeNonStandard "month" "month" ((30.0 * 24.0 + 10.0) * 3600.0) second
-- | Unit of time, *1 year = 365 days*.
year ∷ DerivedUnit
year = makeNonStandard "year" "year" (365.0 * 24.0 * 3600.0) second