3c: Urbit Time

+year

Date to @da.

Accept a parsed date of form [[a=? y=@ud] m=@ud t=tarp] and produce its @da representation.

Accepts

.det is a $date.

Produces

A @da.

Source

++  year
  |=  det=date
  ^-  @da
  =+  ^=  yer
      ?:  a.det
        (add 292.277.024.400 y.det)
      (sub 292.277.024.400 (dec y.det))
  =+  day=(yawn yer m.det d.t.det)
  (yule day h.t.det m.t.det s.t.det f.t.det)

Examples


+yore

Date from atomic date.

Produces a $date from a @da.

Accepts

.now is a time $atom, @da.

Produces

A $date.

Source

Examples


+yell

Tarp from atomic date.

Produce a $tarp time format from a@da.

Accepts

.now is a @da.

Produces

A $tarp.

Source

Examples


+yule

Daily time to time $atom.

Accepts a $tarp, a parsed daily time, and produces a @da.

Accepts

+rip is a $tarp.

Produces

A time $atom, @da.

Source

Examples


+yall

Time since beginning of time.

Produce the date tuple of [y=@ud m=@ud d=@ud] of the year, month, and day from a number of days from the beginning of the Gregorian calendar.

Accepts

+day is a @ud.

Produces

A cell of unsigned decimals.

Source

Examples


+yawn

Days since beginning of time.

Inverse of +yall, computes number of days A.D. from y/m/d date as the tuple [yer=@ud mot=@ud day=@ud].

Accepts

.yer is an unsigned decimal.

.mon is an unsigned decimal.

.day is an unsigned decimal.

Produces

An unsigned decimal.

Source

Examples


+yelp

Leap year?

Determines whether a year is a leap year. Produces a $flag.

Accepts

.yer is an unsigned decimal.

Produces

A $flag.

Source

Examples


+yo

Time constants core.

Core whose arms contain constants for interacting with Earth time.

Source


+cet:yo

Days in a century.

Derived by multiplying the number of days in a year (365) by the number of years in a century (100), then adding the number days from leap-years in a century (24).

Produces

An $atom.

Source

Examples


+day:yo

Seconds in day.

The number of seconds in a day.

Produces

An $atom.

Source

Examples


+era:yo

Leap-year period.

The number of days in a 400-year period, arrived at by multiplying +cet by four and adding one. This is done because every 400 years, there is a leap-year where there would otherwise not be.

Produces

An $atom.

Source

Examples

Discussion

A year is a leap-year if it's divisible by 4, unless it's divisible by 100, or if it's divisible by 400.


+hor:yo

Seconds in hour.

The number of seconds in an hour. Derived by multiplying the number of seconds in a minute by the minutes in an hour.

Produces

An $atom.

Source

Examples


+jes:yo

Maximum 64-bit timestamp.

This is the number of days (starting from 1970) that can be represented in a 64-bit timestamp. Derived by multiplying +era:yo by 730,692,561.

Produces

An $atom.

Source

Examples

Discussion

The date is December 4, 292,277,026,596.


+mit:yo

Seconds in minute.

The number of seconds in a minute.

Produces

An $atom.

Source

Examples


+moh:yo

Days in month.

The days in each month of the Gregorian common year. A list of unsigned decimal $atoms (Either 28, 30, or 31) denoting the number of days in the month at the year at that index.

Produces

A +list of @ud

Source

Examples


+moy:yo

Days in months of leap-year.

The days in each month of the Gregorian leap-year. A list of unsigned decimal $atoms (Either 29, 30, or 31) denoting the number of days in the month at the leap-year at that index.

Produces

A +list of @ud.

Source

Examples


+qad:yo

Seconds in 4 years.

The number of seconds in four years. Derived by adding one second to the number of seconds in four years.

Produces

An $atom.

Source

Examples


+yer:yo

Seconds in year.

The number of seconds in a year. Derived by multiplying the number of seconds in a day by 365.

Produces

An $atom.

Source

Examples


Last updated