2title = "3c: Urbit Time"
9Time since beginning of time
11Produce the date tuple of `[y=@ud m=@ud d=@ud]` of the year, month, and
12day from a number of days from the beginning of the Gregorian calendar.
16`day` is a an unsigned decimal.
20A cell of unsigned decimals.
27 ^- [y=@ud m=@ud d=@ud]
28 =+ [era=0 cet=0 lep=*?]
29 => .(era (div day era:yo), day (mod day era:yo))
31 ?: (lth day +(cet:yo))
33 => .(lep |, cet 1, day (sub day +(cet:yo)))
34 .(cet (add cet (div day cet:yo)), day (mod day cet:yo))
35 =+ yer=(add (mul 400 era) (mul 100 cet))
36 |- ^- [y=@ud m=@ud d=@ud]
37 =+ dis=?:(lep 366 365)
40 $(yer ner, day (sub day dis), lep =(0 (end 0 2 ner)))
41 |- ^- [y=@ud m=@ud d=@ud]
42 =+ [mot=0 cah=?:(lep moy:yo moh:yo)]
43 |- ^- [y=@ud m=@ud d=@ud]
47 $(mot +(mot), day (sub day zis))
67Days since beginning of time
69Inverse of `yall`, computes number of days A.D. from y/m/d date as the
70tuple `[yer=@ud mot=@ud day=@ud]`.
74`yer` is an unsigned decimal.
76`mon` is an unsigned decimal.
78`day` is an unsigned decimal.
88 |= [yer=@ud mot=@ud day=@ud]
90 => .(mot (dec mot), day (dec day))
94 =+ cah=?:((yelp yer) moy:yo moh:yo)
98 $(mot (dec mot), cah (slag 1 cah), day (add day (snag 0 cah)))
103 $(yer ney, day (add day ?:((yelp ney) 366 365)))
104 ?. =(0 (mod yer 100))
106 $(yer nef, day (add day ?:((yelp nef) 1.461 1.460)))
107 ?. =(0 (mod yer 400))
109 $(yer nec, day (add day ?:((yelp nec) 36.525 36.524)))
110 (add day (mul (div yer 400) (add 1 (mul 4 36.524))))
131Accept a parsed date of form `[[a=? y=@ud] m=@ud t=tarp]` and produce
132its `@d` representation.
150 (add 292.277.024.400 y.det)
151 (sub 292.277.024.400 (dec y.det))
152 =+ day=(yawn yer m.det d.t.det)
153 (yule day h.t.det m.t.det s.t.det f.t.det)
159 > (year [[a=%.y y=2.014] m=8 t=[d=4 h=20 m=4 s=57 f=~[0xd940]]])
160 0x8000000d227df4e9d940000000000000
168Produce a parsed daily time format from, `@d`, an atomic date.
186 =+ [muc=4 raw=(end 6 1 now)]
188 ?: |(=(0 raw) =(0 muc))
191 [(cut 4 [muc 1] raw) $(raw (end 4 muc raw))]
192 =+ day=(div sec day:yo)
193 => .(sec (mod sec day:yo))
194 =+ hor=(div sec hor:yo)
195 => .(sec (mod sec hor:yo))
196 =+ mit=(div sec mit:yo)
197 => .(sec (mod sec mit:yo))
198 [day hor mit sec fan]
204 > (yell ~2014.3.20..05.42.53..7456)
205 [d=106.751.991.820.094 h=5 m=42 s=53 f=~[0x7456]]
207 > (yell ~2014.6.9..19.09.40..8b66)
208 [d=106.751.991.820.175 h=19 m=9 s=40 f=~[0x8b66]]
211 [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
219Determines whether a year contains an ISO 8601 leap-week. Produces a flag.
223`yer` is an unsigned decimal.
234 &(=(0 (mod yer 4)) |(!=(0 (mod yer 100)) =(0 (mod yer 400))))
258Produces a `date` from a `@d`.
262`now` is a time atom, `@d`.
276 :- ?: (gth y.ger 292.277.024.400)
277 [a=& y=(sub y.ger 292.277.024.400)]
278 [a=| y=+((sub 292.277.024.400 y.ger))]
279 [m.ger d.ger h.rip m.rip s.rip f.rip]
285 > (yore ~2014.6.6..21.09.15..0a16)
286 [[a=%.y y=2.014] m=6 t=[d=6 h=21 m=9 s=15 f=~[0xa16]]]
292Daily time to time atom
294Accepts a `tarp`, a parsed daily time, and produces a time atom,
322 (add (lsh 4 muc i.f.rip) $(f.rip t.f.rip))
323 (con (lsh 6 1 sec) fac)
330 > =murica (yell ~1776.7.4)
333 [d=106.751.991.733.273 h=0 m=0 s=0 f=~]
336 0x8000000b62aaf5800000000000000000
341 > `@da`(yule (yell ~2014.3.20..05.42.53..7456))
342 ~2014.3.20..05.42.53..7456
344 > `tarp`[31 12 30 0 ~]
345 [d=31 h=12 m=30 s=0 f=~]
347 > `@dr`(yule `tarp`[31 12 30 0 ~])
356Core whose arms contain constants for interacting with earth time.
369Derived by multiplying the number of days in a year
370(365) by the number of years in a century (100), then adding the number
371days from leap-years in a century (24).
392 > (sub (add 24 (mul 100 365)) cet:yo)
401The number of seconds in a day.
428The number of days in a 400-year period, arrived at by multiplying `cet` by four
429and adding one. This is done because every 400 years, there is a leap-year where
430there would otherwise not be.
448 > (sub era:yo (mul 4 cet:yo))
454A year is a leap-year if:
456- it's divisible by 4;
457- **unless** it's divisible by 100;
458- **or** if it's divisible by 400.
465The number of seconds in an hour. Derived by multiplying the number of
466seconds in a minute by the minutes in an hour.
491Maximum 64-bit timestamp
493This is the number of days (starting from 1970) that can be represented in a
49464-bit timestamp. Derived by multiplying `era:yo` by 730,692,561.
503 ++ jes 106.751.991.084.417
515The date is December 4, 292,277,026,596.
522The number of seconds in a minute.
546The days in each month of the Gregorian common year. A list of unsigned
547decimal atoms (Either 28, 30, or 31) denoting the number of days in the
548month at the year at that index.
557 ++ moh `(list @ud)`[31 28 31 30 31 30 31 31 30 31 30 31 ~]
564 ~[31 28 31 30 31 30 31 31 30 31 30 31]
573Days in months of leap-year
575The days in each month of the Gregorian leap-year. A list of unsigned
576decimal atoms (Either 29, 30, or 31) denoting the number of days in the
577month at the leap-year at that index.
586 ++ moy `(list @ud)`[31 29 31 30 31 30 31 31 30 31 30 31 ~]
593 ~[31 29 31 30 31 30 31 31 30 31 30 31]
604The number of seconds in four years. Derived by adding one second to the
605number of seconds in four years.
629The number of seconds in a year. Derived by multiplying the number of
630seconds 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