~/bend-docscommunity

time.bend relies on unsafe/foreign

raw source on the hub · import bend-kit-time@0.1.3.0/time.bend as Time

Clocks, Duration and Instant, Gregorian dates, RFC 3339 and HTTP-date text, and TZif time zones. Source: https://github.com/paymog/bend-kit/tree/main/time

4 imports
import Base
import bend-kit-int@0.2.0.0/int.bend as Int
import bend-kit-fmt@0.1.0.0/fmt.bend as Fmt
import 0x49814d83de8f70993a43e1002be29ecd/bytes.bend as Bytes

Types

type Duration source · line 9 · raw

Data

secs + nanos / 10^9 seconds, with nanos below 10^9: -0.5 s is Duration{-1, 500000000}.

type Instant source · line 13 · raw

Data

A Duration since 1970-01-01T00:00:00Z. Days are 86400 s: there are no leap seconds.

type Date source · line 17 · raw

Data

A proleptic Gregorian date. The conversions and formats cover years 0 to 9999.

type DateTime source · line 20 · raw

Data

type P source · line 385 · raw

Data

A parser state: the numbers read so far, newest first, and the text left.

type Ttype source · line 603 · raw

Data

A local time type: seconds east of UTC, whether it is daylight time, and its abbreviation.

type Trans source · line 607 · raw

Data

From at on, local time follows types[idx].

type Zone source · line 611 · raw

Data

A TZif zone (RFC 8536): transitions in time order, local time types, and the footer TZ string ("" in version 1).

type TzField source · line 711 · raw

Data

POSIX TZ offsets are seconds west of UTC; transition times are seconds from local midnight.

type TzText source · line 714 · raw

Data

type TzClock source · line 717 · raw

Data

type TzDay source · line 720 · raw

Data

type TzDate source · line 725 · raw

Data

type TzDayPart source · line 728 · raw

Data

type TzDatePart source · line 731 · raw

Data

type TzRule source · line 734 · raw

Data

type TzEvent source · line 1078 · raw

Data

Apply the two transitions for the UTC year and its neighbors. A /time may cross a year boundary.

Definitions

def i64 source · line 23 · raw

@x:U32 -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

def i64s source · line 27 · raw

@x:U32 -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

The signed 32-bit value of x, widened.

def i64.of source · line 33 · raw

@hi:U32 -> @lo:U32 -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

hi * 2^32 + lo, as the bits of an I64.

def Duration.zero source · line 39 · raw

Duration

def Duration.of_secs source · line 42 · raw

@s:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Duration

def Duration.of_ms source · line 45 · raw

@+ms:U32 -> Duration

def Duration.to_ms source · line 49 · raw

@d:Duration -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

Whole milliseconds, rounded down.

def Duration.to_nat.of source · line 54 · raw

@m:Maybe<&2, Nat> -> @+per:Nat -> @+n:U32 -> Nat

def Duration.to_ms_nat source · line 62 · raw

@d:Duration -> Nat

Whole milliseconds, rounded down; 0 when d is negative.

def Duration.to_us_nat source · line 68 · raw

@d:Duration -> Nat

Whole microseconds, rounded down; 0 when d is negative.

def Duration.carry source · line 73 · raw

@c:Bool -> @s:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @+n:U32 -> Duration

def Duration.add source · line 80 · raw

@a:Duration -> @b:Duration -> Duration

def Duration.borrow source · line 87 · raw

@c:Bool -> @s:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @+n:U32 -> Duration

n is na - nb, wrapped when na < nb.

def Duration.sub source · line 94 · raw

@a:Duration -> @b:Duration -> Duration

def Duration.neg source · line 99 · raw

@d:Duration -> Duration

def Duration.cmp.then source · line 102 · raw

@c:Cmp -> @+na:U32 -> @+nb:U32 -> Cmp

def Duration.cmp source · line 111 · raw

@a:Duration -> @b:Duration -> Cmp

def Instant.epoch source · line 119 · raw

Instant

def Instant.of_unix source · line 122 · raw

@s:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Instant

def Instant.of source · line 125 · raw

@d:Duration -> Instant

def Instant.since_epoch source · line 130 · raw

@i:Instant -> Duration

def Instant.add source · line 135 · raw

@i:Instant -> @d:Duration -> Instant

def Instant.since source · line 139 · raw

@a:Instant -> @b:Instant -> Duration

a - b.

def Instant.cmp source · line 142 · raw

@a:Instant -> @b:Instant -> Cmp

def raw.dur source · line 158 · raw

@r:Pair(U32, Pair(U32, U32)) -> Duration

def mono source · line 163 · raw

IO(Duration)

Time since an unspecified start that never goes back. Use it to measure spans.

def mono.ms source · line 169 · raw

IO(Nat)

Monotonic milliseconds. Pure cores that take a Nat now in ms take this.

def mono.us source · line 175 · raw

IO(Nat)

Monotonic microseconds.

def now source · line 181 · raw

IO(Instant)

The wall clock. It can jump when the system time is set.

def Date.is_leap source · line 189 · raw

@+y:U32 -> Bool

def Date.days_in_month source · line 194 · raw

@+y:U32 -> @+m:U32 -> U32

0 for a month outside 1 to 12.

def Date.valid source · line 199 · raw

@d:Date -> Bool

def Z.EPOCH source · line 207 · raw

U32

z counts days from -0400-03-01, so every date from year 0 has z > 0 in a U32. The civil-days algorithm is Howard Hinnant's, with the year starting in March.

def Date.to_z.at source · line 210 · raw

@+y:U32 -> @+mp:U32 -> @+d:U32 -> U32

def Date.to_z.go source · line 216 · raw

@jf:Bool -> @+y:U32 -> @+m:U32 -> @+d:U32 -> U32

def Date.to_z source · line 223 · raw

@d:Date -> U32

def Date.of_z.fin source · line 228 · raw

@lo:Bool -> @+y:U32 -> @+mp:U32 -> @+d:U32 -> Date

def Date.of_z source · line 235 · raw

@+z:U32 -> Date

def Date.to_days source · line 245 · raw

@d:Date -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

Days since 1970-01-01.

def Date.of_z.if source · line 248 · raw

@ok:Bool -> @+z:U32 -> Maybe<&2, Date>

def Date.of_days source · line 256 · raw

@days:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Date>

The date days after 1970-01-01, or None outside 0000-01-01 to 9999-12-31.

def Date.weekday source · line 262 · raw

@d:Date -> U32

1 for Monday to 7 for Sunday, as in ISO 8601.

def DateTime.valid source · line 268 · raw

@t:DateTime -> Bool

def DateTime.to_instant source · line 275 · raw

@t:DateTime -> Instant

The instant of a UTC date and time. It does not check t; see DateTime.valid.

def DateTime.at source · line 281 · raw

@m:Maybe<&2, Date> -> @+sod:U32 -> @n:U32 -> Maybe<&2, DateTime>

def DateTime.floor source · line 289 · raw

@neg:Bool -> @q:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @r:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @n:U32 -> Maybe<&2, DateTime>

r is secs % 86400, which has the sign of secs.

def DateTime.of_instant source · line 297 · raw

@i:Instant -> Maybe<&2, DateTime>

The UTC date and time of i, or None outside years 0 to 9999.

def pad source · line 306 · raw

@+x:U32 -> @w:Nat -> String

def Duration.show_ms.pos source · line 310 · raw

@d:Duration -> String

Milliseconds with six decimal places.

def Duration.show_ms.sign source · line 315 · raw

@neg:Bool -> @d:Duration -> String

def Duration.show_ms source · line 322 · raw

@d:Duration -> String

def frac.go source · line 328 · raw

@f:Nat -> @z:Bool -> @+n:U32 -> @+w:Nat -> String

The digits of n / 10^(9 - w), with trailing zeros cut. n is not 0.

def frac source · line 340 · raw

@+n:U32 -> String

def DateTime.rfc3339 source · line 343 · raw

@t:DateTime -> String

def rfc3339 source · line 357 · raw

@i:Instant -> Maybe<&2, String>

RFC 3339 in UTC, such as 1985-04-12T23:20:50.52Z. The fraction has no trailing zeros, and is left out when 0.

def WEEKDAYS source · line 360 · raw

List<&2, String>

def MONTHS source · line 363 · raw

List<&2, String>

def name source · line 366 · raw

@xs:List<&2, String> -> @+i:U32 -> String

def DateTime.http_date source · line 369 · raw

@t:DateTime -> String

def http_date source · line 378 · raw

@i:Instant -> Maybe<&2, String>

IMF-fixdate (RFC 9110 §5.6.7), such as Sun, 06 Nov 1994 08:49:37 GMT. It drops the fraction of a second.

def is_digit source · line 388 · raw

@+c:U32 -> Bool

def digits.go source · line 391 · raw

@n:Nat -> @s:String -> @+acc:U32 -> @ok:Bool -> Maybe<&1, Pair(U32, String)>

def push source · line 406 · raw

@vs:List<&2, U32> -> @r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, P>

def num source · line 414 · raw

@n:Nat -> @p:P -> Maybe<&2, P>

Exactly n digits.

def lit.if source · line 419 · raw

@ok:Bool -> @vs:List<&2, U32> -> @t:String -> Maybe<&2, P>

def lit2 source · line 427 · raw

@+a:U32 -> @+b:U32 -> @p:P -> Maybe<&2, P>

One char that is a or b.

def lit source · line 436 · raw

@+c:U32 -> @p:P -> Maybe<&2, P>

def text source · line 439 · raw

@+w:String -> @p:P -> Maybe<&2, P>

def at.head source · line 445 · raw

@+s:String -> Bool

def secfrac.go source · line 453 · raw

@s:String -> @d:Bool -> @+mul:U32 -> @+acc:U32 -> @+k:U32 -> Pair(U32, Pair(U32, String))

Digits after the first nine are read and dropped. d says whether s starts with a digit.

def secfrac.fin source · line 464 · raw

@vs:List<&2, U32> -> @r:Pair(U32, Pair(U32, String)) -> Maybe<&2, P>

def secfrac.if source · line 468 · raw

@dot:Bool -> @vs:List<&2, U32> -> @+s:String -> Maybe<&2, P>

def secfrac source · line 477 · raw

@p:P -> Maybe<&2, P>

An optional '.' and one or more digits, as nanoseconds.

def zone.num source · line 482 · raw

@+neg:U32 -> @vs:List<&2, U32> -> @t:String -> Maybe<&2, P>

def zone.if source · line 488 · raw

@z:Bool -> @plus:Bool -> @minus:Bool -> @vs:List<&2, U32> -> @t:String -> Maybe<&2, P>

def zone source · line 504 · raw

@p:P -> Maybe<&2, P>

Z, or +hh:mm or -hh:mm, as (sign, hh, mm) with sign 1 for west of UTC.

def index.go source · line 513 · raw

@xs:List<&2, String> -> @+w:String -> @+i:U32 -> U32

def word source · line 521 · raw

@+names:List<&2, String> -> @p:P -> Maybe<&2, P>

One of names, as its index.

def mk.if source · line 527 · raw

@ok:Bool -> @t:DateTime -> Maybe<&2, Instant>

def mk source · line 534 · raw

@+t:DateTime -> Maybe<&2, Instant>

def rfc3339.shift source · line 537 · raw

@m:Maybe<&2, Instant> -> @+west:U32 -> @+hh:U32 -> @+mm:U32 -> Maybe<&2, Instant>

def rfc3339.fin source · line 546 · raw

@p:P -> Maybe<&2, Instant>

def rfc3339.parse source · line 555 · raw

@s:String -> Maybe<&2, Instant>

An RFC 3339 date-time (§5.6), such as 1985-04-12T23:20:50.52Z or 1996-12-19T16:39:57-08:00. T and Z may be lowercase. A leap second (:60) is refused, as Instant has none.

def http_date.fin source · line 572 · raw

@p:P -> Maybe<&2, Instant>

def http_date.parse source · line 581 · raw

@s:String -> Maybe<&2, Instant>

An IMF-fixdate (RFC 9110 §5.6.7), such as Sun, 06 Nov 1994 08:49:37 GMT. The day name must be one of the seven, but it is not checked against the date.

def be source · line 615 · raw

@n:Nat -> @s:String -> @+acc:U32 -> U32

n bytes of a byte string, big-endian.

def be32 source · line 626 · raw

@+s:String -> @n:Nat -> U32

def u8 source · line 629 · raw

@+s:String -> @n:Nat -> U32

def tzif.size source · line 632 · raw

@t8:Bool -> Nat

def tzif.time source · line 639 · raw

@t8:Bool -> @+s:String -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

def tzif.trans source · line 647 · raw

@n:Nat -> @+t8:Bool -> @+ts:String -> @+ks:String -> List<&2, Trans>

ts holds the transition times and ks their type indexes.

def tzif.abbr source · line 656 · raw

@chars:String -> @+i:U32 -> String

The NUL-terminated abbreviation at byte i of chars.

def tzif.types source · line 659 · raw

@n:Nat -> @+s:String -> @+chars:String -> List<&2, Ttype>

def tzif.if source · line 667 · raw

@ok:Bool -> @z:Zone -> Maybe<&2, Zone>

def tzif.count source · line 675 · raw

@+h:String -> @i:Nat -> Nat

Header counts, in RFC 8536 order: isut, isstd, leap, time, type, char.

def tzif.bsize source · line 679 · raw

@+t8:Bool -> @+h:String -> Nat

The data block's size in bytes, for header h.

def tzif.block source · line 685 · raw

@+t8:Bool -> @+h:String -> Maybe<&2, Zone>

h starts at a header; its data block follows it. Version 2+ blocks have 8-byte times and a footer.

def tzif.go source · line 697 · raw

@v2:Bool -> @+s:String -> Maybe<&2, Zone>

def tzif.parse source · line 706 · raw

@b:0x49814d83de8f70993a43e1002be29ecd/bytes.Bytes -> Maybe<&2, Zone>

A TZif file, such as one from /usr/share/zoneinfo. Versions 2 and up use their 64-bit block. ponytail: reads the bytes as a byte String; walk Bytes directly if zone files get big.

def tz.digit source · line 737 · raw

@+c:U32 -> Bool

def tz.alpha source · line 740 · raw

@+c:U32 -> Bool

def tz.quoted source · line 744 · raw

@+c:U32 -> Bool

def tz.number.stop source · line 747 · raw

@seen:Bool -> @acc:U32 -> @s:String -> Maybe<&2, TzField>

def tz.number.step source · line 754 · raw

@digit:Bool -> @c:U32 -> @t:String -> @acc:U32 -> @seen:Bool -> @next:(@_:Unit -> Maybe<&2, TzField>) -> Maybe<&2, TzField>

def tz.number.go source · line 762 · raw

@s:String -> @+acc:U32 -> @+seen:Bool -> Maybe<&2, TzField>

Three digits suffice for POSIX hour, day, and month fields.

def tz.number source · line 770 · raw

@s:String -> Maybe<&2, TzField>

def tz.name.valid source · line 773 · raw

@ok:Bool -> @name:String -> @rest:String -> Maybe<&2, TzText>

def tz.name.done source · line 780 · raw

@rev:String -> @rest:String -> Maybe<&2, TzText>

def tz.name.empty source · line 784 · raw

@quoted:Bool -> @rev:String -> Maybe<&2, TzText>

def tz.name.branch source · line 791 · raw

@continue:Bool -> @rev:String -> @c:U32 -> @rest:String -> @next:(@_:Unit -> Maybe<&2, TzText>) -> Maybe<&2, TzText>

def tz.name.allowed source · line 798 · raw

@ok:Bool -> @next:(@_:Unit -> Maybe<&2, TzText>) -> Maybe<&2, TzText>

def tz.name.quoted source · line 805 · raw

@end:Bool -> @valid:Bool -> @rev:String -> @rest:String -> @next:(@_:Unit -> Maybe<&2, TzText>) -> Maybe<&2, TzText>

def tz.name.char source · line 812 · raw

@quoted:Bool -> @end:Bool -> @alpha:Bool -> @valid:Bool -> @rev:String -> @c:U32 -> @rest:String -> @next:(@_:Unit -> Maybe<&2, TzText>) -> Maybe<&2, TzText>

def tz.name.go source · line 820 · raw

@s:String -> @+rev:String -> @+quoted:Bool -> Maybe<&2, TzText>

def tz.name source · line 828 · raw

@s:String -> Maybe<&2, TzText>

def tz.field.valid source · line 835 · raw

@ok:Bool -> @n:U32 -> @rest:String -> Maybe<&2, TzField>

def tz.clock.tail source · line 842 · raw

@r:TzField -> @limit:U32 -> Maybe<&2, TzField>

def tz.clock.part source · line 847 · raw

@s:String -> Maybe<&2, TzField>

def tz.clock.valid source · line 856 · raw

@ok:Bool -> @+value:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @negative:Bool -> @rest:String -> Maybe<&2, TzClock>

def tz.clock.seconds source · line 863 · raw

@sec:TzField -> @+hours:U32 -> @+minutes:U32 -> @+max:U32 -> @negative:Bool -> Maybe<&2, TzClock>

def tz.clock.minutes source · line 869 · raw

@m:TzField -> @+hours:U32 -> @+max:U32 -> @+negative:Bool -> Maybe<&2, TzClock>

def tz.clock.finish source · line 875 · raw

@h:TzField -> @+max:U32 -> @+negative:Bool -> Maybe<&2, TzClock>

def tz.clock.read source · line 883 · raw

@s:String -> @max:U32 -> @negative:Bool -> Maybe<&2, TzClock>

def tz.clock.sign source · line 887 · raw

@s:String -> @max:U32 -> Maybe<&2, TzClock>

def tz.day.valid source · line 897 · raw

@ok:Bool -> @d:TzDay -> @rest:String -> Maybe<&2, TzDayPart>

def tz.day.j source · line 904 · raw

@r:TzField -> Maybe<&2, TzDayPart>

def tz.day.n source · line 909 · raw

@r:TzField -> Maybe<&2, TzDayPart>

def tz.after source · line 914 · raw

@c:Char -> @s:String -> String

def tz.day.weekday source · line 921 · raw

@c:TzField -> @+month:U32 -> @+week:U32 -> Maybe<&2, TzDayPart>

def tz.day.week source · line 928 · raw

@b:TzField -> @month:U32 -> Maybe<&2, TzDayPart>

def tz.day.month source · line 935 · raw

@a:TzField -> Maybe<&2, TzDayPart>

def tz.day.m source · line 942 · raw

@s:String -> Maybe<&2, TzDayPart>

def tz.day source · line 947 · raw

@s:String -> Maybe<&2, TzDayPart>

def tz.date.clock source · line 960 · raw

@d:TzDay -> @r:TzClock -> Maybe<&2, TzDatePart>

def tz.date.time source · line 965 · raw

@d:TzDay -> @rest:String -> Maybe<&2, TzDatePart>

def tz.date.part source · line 974 · raw

@r:TzDayPart -> Maybe<&2, TzDatePart>

def tz.date source · line 979 · raw

@s:String -> Maybe<&2, TzDatePart>

def tz.rule.end source · line 984 · raw

@ok:Bool -> @standard:Ttype -> @daylight:Ttype -> @start:TzDate -> @end:TzDate -> Maybe<&2, TzRule>

def tz.rule.finish source · line 991 · raw

@b:TzDatePart -> @standard:Ttype -> @daylight:Ttype -> @start:TzDate -> Maybe<&2, TzRule>

def tz.rule.start source · line 996 · raw

@a:TzDatePart -> @+standard:Ttype -> @+daylight:Ttype -> Maybe<&2, TzRule>

def tz.rule.dates source · line 1003 · raw

@+standard:Ttype -> @+daylight:Ttype -> @rest:String -> Maybe<&2, TzRule>

def tz.rule.dstclock source · line 1008 · raw

@r:TzClock -> @standard:Ttype -> @abbr:String -> Maybe<&2, TzRule>

def tz.rule.offset source · line 1013 · raw

@standard:Ttype -> @abbr:String -> @west:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @rest:String -> Maybe<&2, TzRule>

def tz.rule.named source · line 1026 · raw

@name:TzText -> @standard:Ttype -> @west:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, TzRule>

def tz.rule.dst source · line 1031 · raw

@+standard:Ttype -> @west:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @rest:String -> Maybe<&2, TzRule>

def tz.rule.stdclock source · line 1040 · raw

@offset:TzClock -> @abbr:String -> Maybe<&2, TzRule>

def tz.rule.standard source · line 1045 · raw

@name:TzText -> Maybe<&2, TzRule>

def tz.rule source · line 1052 · raw

@s:String -> Maybe<&2, TzRule>

def tz.day.index source · line 1058 · raw

@d:TzDay -> @+y:U32 -> U32

The day number of a rule in year y, relative to January 1.

def tz.date.utc source · line 1071 · raw

@d:TzDate -> @+y:U32 -> @west:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> 0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64

def tz.event.select source · line 1081 · raw

@newer:Bool -> @old:Maybe<&2, TzEvent> -> @when:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @dst:Bool -> Maybe<&2, TzEvent>

def tz.event.new source · line 1088 · raw

@+now:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @old:Maybe<&2, TzEvent> -> @+when:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @dst:Bool -> Maybe<&2, TzEvent>

def tz.event.year source · line 1096 · raw

@+now:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @old:Maybe<&2, TzEvent> -> @+r:TzRule -> @+y:U32 -> Maybe<&2, TzEvent>

def tz.event.prev source · line 1102 · raw

@+now:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @old:Maybe<&2, TzEvent> -> @+r:TzRule -> @+y:U32 -> Maybe<&2, TzEvent>

def tz.event.next.if source · line 1109 · raw

@valid:Bool -> @now:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @old:Maybe<&2, TzEvent> -> @r:TzRule -> @y:U32 -> Maybe<&2, TzEvent>

def tz.event.next source · line 1115 · raw

@+now:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @old:Maybe<&2, TzEvent> -> @+r:TzRule -> @+y:U32 -> Maybe<&2, TzEvent>

def tz.event.type source · line 1119 · raw

@ev:Maybe<&2, TzEvent> -> @+r:TzRule -> Ttype

def tz.rule.at source · line 1130 · raw

@+r:TzRule -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @+year:U32 -> Ttype

def tz.rule.date source · line 1135 · raw

@d:Maybe<&2, DateTime> -> @r:TzRule -> @secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Ttype>

def tz.rule.lookup source · line 1142 · raw

@rule:Maybe<&2, TzRule> -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Ttype>

def Zone.find source · line 1151 · raw

@ts:List<&2, Trans> -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @+cur:U32 -> U32

The type index at secs: the last transition at or before it, or type 0 before the first. ponytail: linear scan; bisect an Array if lookups get hot.

def Zone.last.go source · line 1157 · raw

@ts:List<&2, Trans> -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> @+last:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Bool

def Zone.last source · line 1163 · raw

@ts:List<&2, Trans> -> @secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Bool

def Zone.at.fallback source · line 1171 · raw

@m:Maybe<&2, Ttype> -> @types:List<&2, Ttype> -> @ts:List<&2, Trans> -> @secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Ttype>

def Zone.at.footer source · line 1177 · raw

@use:Bool -> @tz:String -> @types:List<&2, Ttype> -> @ts:List<&2, Trans> -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Ttype>

def Zone.at.tz source · line 1184 · raw

@empty:Bool -> @tz:String -> @types:List<&2, Ttype> -> @+ts:List<&2, Trans> -> @+secs:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> Maybe<&2, Ttype>

def Zone.at source · line 1194 · raw

@z:Zone -> @i:Instant -> Maybe<&2, Ttype>

The local time type at i. The footer applies strictly after the final explicit transition.

def Zone.local.at source · line 1199 · raw

@m:Maybe<&2, Ttype> -> @i:Instant -> Maybe<&2, DateTime>

def Zone.local source · line 1207 · raw

@z:Zone -> @+i:Instant -> Maybe<&2, DateTime>

The local date and time at i in zone z.

Templates

template fmt.map source · line 349 · raw

@-f:(@_:DateTime -> String) -> @m:Maybe<&2, DateTime> -> Maybe<&2, String>

Effects (foreign code)

effect mono.raw source · line 149 · raw

IO(Pair(U32, Pair(U32, U32)))

(secs hi, secs lo, nanos) of CLOCK_MONOTONIC, from an unspecified start.

foreign: effs/time.c, effs/time.js

effect wall.raw source · line 154 · raw

IO(Pair(U32, Pair(U32, U32)))

(secs hi, secs lo, nanos) of CLOCK_REALTIME, since the Unix epoch.

foreign: effs/time.c, effs/time.js