2title = "3c: Urbit Time"
11Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
12its `@da` representation.
30 (add 292.277.024.400 y.det)
31 (sub 292.277.024.400 (dec y.det))
32 =+ day=(yawn yer m.det d.t.det)
33 (yule day h.t.det m.t.det s.t.det f.t.det)
39> (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
40~2014.8.4..20.04.57..d940
49Produces a `date` from a `@da`.
53`now` is a time atom, `@da`.
67 :- ?: (gth y.ger 292.277.024.400)
68 [a=& y=(sub y.ger 292.277.024.400)]
69 [a=| y=+((sub 292.277.024.400 y.ger))]
70 [m.ger d.ger h.rip m.rip s.rip f.rip]
76> (yore ~2014.6.6..21.09.15..0a16)
77[[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
86Produce a [`$tarp`](/docs/hoon/reference/stdlib/2q#tarp) time format from a`@da`.
104 =+ [muc=4 raw=(end 6 now)]
106 ?: |(=(0 raw) =(0 muc))
109 [(cut 4 [muc 1] raw) $(raw (end [4 muc] raw))]
110 =+ day=(div sec day:yo)
111 => .(sec (mod sec day:yo))
112 =+ hor=(div sec hor:yo)
113 => .(sec (mod sec hor:yo))
114 =+ mit=(div sec mit:yo)
115 => .(sec (mod sec mit:yo))
116 [day hor mit sec fan]
122> (yell ~2014.3.20..05.42.53..7456)
123[d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
125> (yell ~2014.6.9..19.09.40..8b66)
126[d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]]
129[d=106.751.991.733.273 h=0 m=0 s=0 f=~]
136Daily time to time atom
138Accepts a [`$tarp`](/docs/hoon/reference/stdlib/2q#tarp), a parsed daily time,
166 (add (lsh [4 muc] i.f.rip) $(f.rip t.f.rip))
167 (con (lsh 6 sec) fac)
173> =murica (yell ~1776.7.4)
176[d=106.751.991.733.273 h=0 m=0 s=0 f=~]
1790x8000000b62aaf5800000000000000000
184> `@da`(yule (yell ~2014.3.20..05.42.53..7456))
185~2014.3.20..05.42.53..7456
187> `tarp`[31 12 30 0 ~]
188[d=31 h=12 m=30 s=0 f=~]
190> `@dr`(yule `tarp`[31 12 30 0 ~])
198Time since beginning of time
200Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
201day from a number of days from the beginning of the Gregorian calendar.
209A cell of unsigned decimals.
216 ^- [y=@ud m=@ud d=@ud]
217 =+ [era=0 cet=0 lep=*?]
218 => .(era (div day era:yo), day (mod day era:yo))
220 ?: (lth day +(cet:yo))
222 => .(lep |, cet 1, day (sub day +(cet:yo)))
223 .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
224 =+ yer=(add (mul 400 era) (mul 100 cet))
225 |- ^- [y=@ud m=@ud d=@ud]
226 =+ dis=?:(lep 366 365)
229 $(yer ner, day (sub day dis), lep =(0 (end [0 2] ner)))
230 |- ^- [y=@ud m=@ud d=@ud]
231 =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
232 |- ^- [y=@ud m=@ud d=@ud]
233 =+ zis=(snag mot cah)
236 $(mot +(mot), day (sub day zis))
256Days since beginning of time
258Inverse of `yall`, computes number of days A.D. from y/m/d date as the
259tuple `[yer=@ud mot=@ud day=@ud]`.
263`yer` is an unsigned decimal.
265`mon` is an unsigned decimal.
267`day` is an unsigned decimal.
277 |= [yer=@ud mot=@ud day=@ud]
279 => .(mot (dec mot), day (dec day))
283 =+ cah=?:((yelp yer) moy:yo moh:yo)
287 $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
292 $(yer ney, day (add day ?:((yelp ney) 366 365)))
293 ?. =(0 (mod yer 100))
295 $(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
296 ?. =(0 (mod yer 400))
298 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
299 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
321Determines whether a year is a leap year. Produces a flag.
325`yer` is an unsigned decimal.
336 &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
361Core whose arms contain constants for interacting with earth time.
375Derived by multiplying the number of days in a year
376(365) by the number of years in a century (100), then adding the number
377days from leap-years in a century (24).
398> (sub (add 24 (mul 100 365)) cet:yo)
408The number of seconds in a day.
436The number of days in a 400-year period, arrived at by multiplying `cet` by four
437and adding one. This is done because every 400 years, there is a leap-year where
438there would otherwise not be.
456> (sub era:yo (mul 4 cet:yo))
462A year is a leap-year if:
464- it's divisible by 4;
465- **unless** it's divisible by 100;
466- **or** if it's divisible by 400.
474The number of seconds in an hour. Derived by multiplying the number of
475seconds in a minute by the minutes in an hour.
501Maximum 64-bit timestamp
503This is the number of days (starting from 1970) that can be represented in a
50464-bit timestamp. Derived by multiplying `era:yo` by 730,692,561.
513++ jes 106.751.991.084.417
525The date is December 4, 292,277,026,596.
533The number of seconds in a minute.
558The days in each month of the Gregorian common year. A list of unsigned
559decimal atoms (Either 28, 30, or 31) denoting the number of days in the
560month at the year at that index.
569++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
576~[31 28 31 30 31 30 31 31 30 31 30 31]
586Days in months of leap-year
588The days in each month of the Gregorian leap-year. A list of unsigned
589decimal atoms (Either 29, 30, or 31) denoting the number of days in the
590month at the leap-year at that index.
599++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
606~[31 29 31 30 31 30 31 31 30 31 30 31]
618The number of seconds in four years. Derived by adding one second to the
619number of seconds in four years.
644The number of seconds in a year. Derived by multiplying the number of
645seconds in a day by 365.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list