Skip to content
Systems programming for what’s next.
— Vex

std::time API Reference ​

Development snapshot. Generated from the current repository source. This inventory may include internal and test declarations; it is not a list of supported public APIs. Check the module guide and the compiler version you use before relying on an entry.

Application entry points ​

Use the time overview and Time/Duration guide for units, overflow, UTC parsing and monotonic deadlines. Import application APIs from "time"; timezone provider FFI and test helpers are implementation inventory.

Overview ​

Structs: DateParts · Duration · Timer · Ticker · Instant · Location · tm · tm · SYSTEMTIME · TIME_ZONE_INFORMATION · ScanResult · ScanResult64 · DateTimeParts · Time

Enums: Month · Weekday

Functions: abs_date · is_leap · nsToDateTime · magnitude · seconds · milliseconds · microseconds · nanoseconds · minutes · hours · fmt_int · format_layout · now · sleep · sleep · getLocalOffset · since · until · truncate · round · unix · unix_seconds · unix_nanosecond · unix_milli · unix_micro · compare · before · after · equal · after · weekday · date · clock · newTimer · newTicker · afterDuration · tz_pad2 · tz_pad4 · formatInLocation · toRFC3339InLocation · inLocation · isDST · signedDurationBetween · utc · local · fixed_zone · load_location · UTC · Local · fixedZone · loadLocation · EST · PST · CET · TRT · JST · vex_tz_offset_at_shim · vex_tz_exists_shim · vex_get_local_offset · vex_tz_offset_at_shim · vex_tz_exists_shim · vex_get_local_offset · unsupportedTimeProvider · vex_time_current_ns · vex_monotonic_ns · vex_nanosleep · vex_get_local_offset · vex_tz_offset_at_shim · vex_tz_exists_shim · vex_tz_offset_at_shim · vex_tz_exists_shim · vex_get_local_offset · isDigit · scan_int_at · scanRfc2 · scanRfc4 · scan_nanos_at · daysFromCivil · validDateTime · partsToNs · parse · parse_rfc3339 · parse_duration · days_in_month · ns_to_datetime · floor_div · add · sub · write_padded_int · expect · test_monotonic · test_now_since_until_and_add · test_parse_duration · test_rfc3339_parse_components · test_unix_helpers · test_rfc3339_millisecond_writer · test_time_checked_and_saturating_boundaries · test_compare_and_order · test_truncate_and_round · test_after_channel · test_duration_overflow_policies · test_instant_is_typed_and_monotonic · test_rfc3339_offsets_and_fraction · test_rfc3339_validation_and_i64_boundaries · test_duration_fraction_sign_units_and_boundaries · bench_instant_now · bench_time_now · bench_time_checked_add · bench_duration_checked_arithmetic · bench_parse_rfc3339_utc · bench_parse_rfc3339_offset · bench_parse_duration_compound · bench_duration_to_string · bench_time_to_string · test_now_and_monotonic · test_unix_construction · test_parse_duration_basic · test_duration_constants · test_arithmetic · test_since_until · test_rfc3339_parse · test_zones · test_date_components · test_clock_components · test_weekday_yearday · test_comparisons · test_truncate_round · test_unix_helpers · test_start_end_of_boundaries · test_timer_ticker_phase2 · test_after_channel_api · test_load_location_dst_rules · test_dst_transition_instants · test_location_clone_preserves_heap_backed_name · test_duration_tostring · test_duration_neg_cmp · test_add_date · test_in_location · test_rfc3339_with_offset · test_is_dst · test_extra_timezone_aliases · test_au_sydney_dst · test_time_format · main

Constants: NANOSECOND · MICROSECOND · MILLISECOND · SECOND · MINUTE · HOUR · DAY · RFC3339

Constants ​

NANOSECOND 🔓 export ​

📄 constants.vx L33-33

vex
export const NANOSECOND: i64=1;

MICROSECOND 🔓 export ​

📄 constants.vx L34-34

vex
export const MICROSECOND: i64=1000 * NANOSECOND;

MILLISECOND 🔓 export ​

📄 constants.vx L35-35

vex
export const MILLISECOND: i64=1000 * MICROSECOND;

SECOND 🔓 export ​

📄 constants.vx L36-36

vex
export const SECOND: i64=1000 * MILLISECOND;

MINUTE 🔓 export ​

📄 constants.vx L37-37

vex
export const MINUTE: i64=60 * SECOND;

HOUR 🔓 export ​

📄 constants.vx L38-38

vex
export const HOUR: i64=60 * MINUTE;

DAY 🔓 export ​

📄 constants.vx L39-39

vex
export const DAY: i64=24 * HOUR;

RFC3339 🔓 export ​

📄 constants.vx L42-42

vex
export const RFC3339: string="2006-01-02T15:04:05Z07:00";

Structs ​

DateParts 🔓 export ​

📄 conversions.vx L7-12

vex
export struct DateParts

Fields:

NameTypeAccess
yi32🔒 readonly
mi32🔒 readonly
di32🔒 readonly

Duration 🔓 export ​

📄 duration.vx L5-8

vex
export struct Duration

Implements: Display & Clone & Copy & Eq & Ord

Fields:

NameTypeAccess
nsi64🔒 readonly

Methods:

MethodSignatureDescription
Duration.seconds↗export fn Duration.seconds(s: i64): Duration
Duration.milliseconds↗export fn Duration.milliseconds(ms: i64): Duration
Duration.microseconds↗export fn Duration.microseconds(us: i64): Duration
Duration.nanoseconds↗export fn Duration.nanoseconds(ns: i64): Duration
Duration.minutes↗export fn Duration.minutes(m: i64): Duration
Duration.hours↗export fn Duration.hours(h: i64): Duration
asSeconds↗export fn (self: &Duration) asSeconds(): i64
asMillis↗export fn (self: &Duration) asMillis(): i64
asMicros↗export fn (self: &Duration) asMicros(): i64
asNanos↗export fn (self: &Duration) asNanos(): i64
asMinutes↗export fn (self: &Duration) asMinutes(): i64
asHours↗export fn (self: &Duration) asHours(): i64
add↗export fn (self: &Duration) add(other: Duration): Duration
sub↗export fn (self: &Duration) sub(other: Duration): Duration
mul↗export fn (self: &Duration) mul(n: i64): Duration
div↗export fn (self: &Duration) div(n: i64): Duration
checkedAdd↗export fn (self: &Duration) checkedAdd(other: Duration): Option<Duration>
checkedSub↗export fn (self: &Duration) checkedSub(other: Duration): Option<Duration>
checkedMul↗export fn (self: &Duration) checkedMul(n: i64): Option<Duration>
checkedDiv↗export fn (self: &Duration) checkedDiv(n: i64): Option<Duration>
saturatingAdd↗export fn (self: &Duration) saturatingAdd(other: Duration): Duration
saturatingSub↗export fn (self: &Duration) saturatingSub(other: Duration): Duration
saturatingMul↗export fn (self: &Duration) saturatingMul(n: i64): Duration
isZero↗export fn (self: &Duration) isZero(): bool
isNegative↗export fn (self: &Duration) isNegative(): bool
abs↗export fn (self: &Duration) abs(): Duration
saturatingAbs↗export fn (self: &Duration) saturatingAbs(): Duration
clone↗export fn (self: &Duration) clone(): Duration
neg↗export fn (self: &Duration) neg(): Duration
cmp↗export fn (self: &Duration) cmp(other: &Duration): i32
op==↗export fn (self: &Duration) op==(other: &Duration): bool
op<↗export fn (self: &Duration) op<(other: &Duration): bool
op>↗export fn (self: &Duration) op>(other: &Duration): bool
op<=↗export fn (self: &Duration) op<=(other: &Duration): bool
op>=↗export fn (self: &Duration) op>=(other: &Duration): bool
toString↗export fn (self: &Duration) toString(): string

Timer 🔓 export ​

📄 helpers.vx L122-127

vex
export struct Timer

Fields:

NameTypeAccess
deadlineInstant🔒 private
firedbool🔒 private
activebool🔒 private

Methods:

MethodSignatureDescription
Timer.new↗export fn Timer.new(d: Duration): Timer
expired↗export fn (self: &Timer) expired(): bool
poll↗export fn (self: &Timer!) poll(): bool
reset↗export fn (self: &Timer!) reset(d: Duration)
stop↗export fn (self: &Timer!) stop()
wait↗export fn (self: &Timer!) wait(): Time

Ticker 🔓 export ​

📄 helpers.vx L195-200

vex
export struct Ticker

Fields:

NameTypeAccess
intervalDuration🔒 private
nextInstant🔒 private
activebool🔒 private

Methods:

MethodSignatureDescription
Ticker.new↗export fn Ticker.new(d: Duration): Ticker
tick↗export fn (self: &Ticker!) tick(): bool
reset↗export fn (self: &Ticker!) reset(d: Duration)
stop↗export fn (self: &Ticker!) stop()

Instant 🔓 export ​

📄 instant.vx L7-10

vex
export struct Instant

Implements: Clone & Copy & Eq & Ord

Fields:

NameTypeAccess
ticksu64🔒 private

Methods:

MethodSignatureDescription
Instant.now↗export fn Instant.now(): Instant
clone↗export fn (self: &Instant) clone(): Instant
asNanos↗export fn (self: &Instant) asNanos(): u64Process-local clock reading for diagnostics and native interop. It has no
durationSince↗export fn (self: &Instant) durationSince(earlier: Instant): DurationSigned difference with saturation at Duration's representable limits.
saturatingDurationSince↗export fn (self: &Instant) saturatingDurationSince(earlier: Instant): DurationNon-negative difference; clock anomalies or reversed operands yield zero.
elapsed↗export fn (self: &Instant) elapsed(): Duration
checkedAdd↗export fn (self: &Instant) checkedAdd(duration: Duration): Option<Instant>
checkedSub↗export fn (self: &Instant) checkedSub(duration: Duration): Option<Instant>
saturatingAdd↗export fn (self: &Instant) saturatingAdd(duration: Duration): Instant
saturatingSub↗export fn (self: &Instant) saturatingSub(duration: Duration): Instant
op==↗export fn (self: &Instant) op==(other: &Instant): bool
op<↗export fn (self: &Instant) op<(other: &Instant): bool
op>↗export fn (self: &Instant) op>(other: &Instant): bool
op<=↗export fn (self: &Instant) op<=(other: &Instant): bool
op>=↗export fn (self: &Instant) op>=(other: &Instant): bool

Location 🔓 export ​

📄 location.vx L17-27

vex
export struct Location

Implements: Display & Clone

Fields:

NameTypeAccess
namestring🔒 private
offsetSecondsi64🔒 private
isDynamici32🔒 private

Methods:

MethodSignatureDescription
Location.utc↗export fn Location.utc(): Location
Location.local↗export fn Location.local(): Location
Location.fixedZone↗export fn Location.fixedZone(name: string, offsetSeconds: i64): Location
Location.load↗export fn Location.load(name: string): Result<Location, string>
offset↗export fn (self: &Location) offset(): i64Standard (base) offset in seconds.
offsetAtUnix↗export fn (self: &Location) offsetAtUnix(unixSec: i64): i64Actual UTC offset at an arbitrary Unix timestamp.
offsetAt↗export fn (self: &Location) offsetAt(t: Time): i64Offset at a Time instant.
offsetHours↗export fn (self: &Location) offsetHours(): i32Offset in whole hours.
clone↗export fn (self: &Location) clone(): LocationClone.
toString↗export fn (self: &Location) toString(): stringDisplay: "America/New_York (UTC-5)"

tm ​

📄 native.linux.vxc L9-22

vex
struct tm

Fields:

NameTypeAccess
tm_seci32🔓 public
tm_mini32🔓 public
tm_houri32🔓 public
tm_mdayi32🔓 public
tm_moni32🔓 public
tm_yeari32🔓 public
tm_wdayi32🔓 public
tm_ydayi32🔓 public
tm_isdsti32🔓 public
tm_gmtoffi64🔓 public
tm_zonePtr<u8>🔓 public

tm ​

📄 native.macos.vxc L9-22

vex
struct tm

Fields:

NameTypeAccess
tm_seci32🔓 public
tm_mini32🔓 public
tm_houri32🔓 public
tm_mdayi32🔓 public
tm_moni32🔓 public
tm_yeari32🔓 public
tm_wdayi32🔓 public
tm_ydayi32🔓 public
tm_isdsti32🔓 public
tm_gmtoffi64🔓 public
tm_zonePtr<u8>🔓 public

SYSTEMTIME ​

📄 native.windows.vxc L4-13

vex
struct SYSTEMTIME

Fields:

NameTypeAccess
wYearu16🔒 private
wMonthu16🔒 private
wDayOfWeeku16🔒 private
wDayu16🔒 private
wHouru16🔒 private
wMinuteu16🔒 private
wSecondu16🔒 private
wMillisecondsu16🔒 private

TIME_ZONE_INFORMATION ​

📄 native.windows.vxc L15-24

vex
struct TIME_ZONE_INFORMATION

Fields:

NameTypeAccess
Biasi32🔓 public
StandardName[u16; 32]🔓 public
StandardDateSYSTEMTIME🔓 public
StandardBiasi32🔓 public
DaylightName[u16; 32]🔓 public
DaylightDateSYSTEMTIME🔓 public
DaylightBiasi32🔓 public

ScanResult ​

📄 parse.vx L6-10

vex
struct ScanResult

Fields:

NameTypeAccess
valuei32🔓 public
counti32🔓 public

ScanResult64 ​

📄 parse.vx L11-15

vex
struct ScanResult64

Fields:

NameTypeAccess
valuei64🔓 public
counti32🔓 public

DateTimeParts 🔓 export ​

📄 time_type.vx L28-37

vex
export struct DateTimeParts

Fields:

NameTypeAccess
yi32🔒 readonly
moi32🔒 readonly
di32🔒 readonly
hi32🔒 readonly
mini32🔒 readonly
si32🔒 readonly
wdi32🔒 readonly

Methods:

MethodSignatureDescription
year↗export fn (self: &DateTimeParts) year(): i32
month↗export fn (self: &DateTimeParts) month(): i32
day↗export fn (self: &DateTimeParts) day(): i32
hour↗export fn (self: &DateTimeParts) hour(): i32
minute↗export fn (self: &DateTimeParts) minute(): i32
second↗export fn (self: &DateTimeParts) second(): i32
weekday↗export fn (self: &DateTimeParts) weekday(): i32

Time 🔓 export ​

📄 time_type.vx L78-81

vex
export struct Time

Implements: Display & Clone & Copy & Eq & Ord

Fields:

NameTypeAccess
nsi64🔒 readonly

Methods:

MethodSignatureDescription
Time.now↗export fn Time.now(): Time
Time.unix↗export fn Time.unix(sec: i64, nsec: i64): Time
Time.checkedUnix↗export fn Time.checkedUnix(sec: i64, nsec: i64): Option<Time>Constructs Unix time while normalizing an arbitrary nanosecond offset.
Time.fromUnixNanos↗export fn Time.fromUnixNanos(ns: i64): TimeConstructs an absolute time from nanoseconds since the Unix epoch.
clone↗export fn (self: &Time) clone(): Time
cmp↗export fn (self: &Time) cmp(other: &Time): i32
op==↗export fn (self: &Time) op==(other: &Time): bool
op<↗export fn (self: &Time) op<(other: &Time): bool
op>↗export fn (self: &Time) op>(other: &Time): bool
op<=↗export fn (self: &Time) op<=(other: &Time): bool
op>=↗export fn (self: &Time) op>=(other: &Time): bool
toString↗export fn (self: &Time) toString(): string
writeRFC3339MillisTo↗export fn (self: &Time) writeRFC3339MillisTo(out: &StringBuilder!)Append the UTC timestamp in fixed-width RFC 3339 millisecond form.
unix↗export fn (self: &Time) unix(): i64
unixNano↗export fn (self: &Time) unixNano(): i64Total nanoseconds elapsed since the Unix epoch.
unixMilli↗export fn (self: &Time) unixMilli(): i64Total milliseconds elapsed since the Unix epoch, rounded toward the past.
unixMicro↗export fn (self: &Time) unixMicro(): i64Total microseconds elapsed since the Unix epoch, rounded toward the past.
nanosecond↗export fn (self: &Time) nanosecond(): i64Nanosecond offset within the current Unix second (0..999_999_999).
checkedAdd↗export fn (self: &Time) checkedAdd(d: Duration): Option<Time>
add↗export fn (self: &Time) add(d: Duration): Time
saturatingAdd↗export fn (self: &Time) saturatingAdd(d: Duration): Time
checkedDurationSince↗export fn (self: &Time) checkedDurationSince(earlier: Time): Option<Duration>
durationSince↗export fn (self: &Time) durationSince(earlier: Time): Duration
year↗export fn (self: &Time) year(): i64
month↗export fn (self: &Time) month(): Month
day↗export fn (self: &Time) day(): i64
hour↗export fn (self: &Time) hour(): i64
minute↗export fn (self: &Time) minute(): i64
second↗export fn (self: &Time) second(): i64
weekday↗export fn (self: &Time) weekday(): Weekday
addDate↗export fn (self: &Time) addDate(years: i32, months: i32, days: i32): Time
withOffset↗export fn (self: &Time) withOffset(offsetSec: i64): Time
formatWithOffset↗export fn (self: &Time) formatWithOffset(layout: str, offsetSec: i64): string
format↗export fn (self: &Time) format(layout: str): string
startOf↗export fn (self: &Time) startOf(unit: str): Time
endOf↗export fn (self: &Time) endOf(unit: str): Time

Enums ​

Month 🔓 export ​

📄 constants.vx L5-18

vex
export enum Month

Variants:

  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December

Weekday 🔓 export ​

📄 constants.vx L20-28

vex
export enum Weekday

Variants:

  • Sunday
  • Monday
  • Tuesday
  • Wednesday
  • Thursday
  • Friday
  • Saturday

Functions ​

abs_date 🔓 export ​

📄 conversions.vx L15-30

vex
export fn abs_date(abs_sec: i64): DateParts

Parameters:

NameType
abs_seci64

Returns: DateParts


is_leap 🔓 export ​

📄 conversions.vx L32-34

vex
export fn is_leap(year: i32): bool

Parameters:

NameType
yeari32

Returns: bool


nsToDateTime 🔓 export ​

📄 conversions.vx L37-58

vex
export fn nsToDateTime(ns: i64): (i32, i32, i32, i32, i32, i32, i32)

Parameters:

NameType
nsi64

Returns: (i32, i32, i32, i32, i32, i32, i32)


magnitude ​

📄 duration.vx L10-16

vex
fn magnitude(value: i64): u64

Parameters:

NameType
valuei64

Returns: u64


seconds 🔓 export ​

📄 duration.vx L47-49

vex
export fn seconds(s: i64): Duration

Parameters:

NameType
si64

Returns: Duration


milliseconds 🔓 export ​

📄 duration.vx L51-53

vex
export fn milliseconds(ms: i64): Duration

Parameters:

NameType
msi64

Returns: Duration


microseconds 🔓 export ​

📄 duration.vx L55-57

vex
export fn microseconds(us: i64): Duration

Parameters:

NameType
usi64

Returns: Duration


nanoseconds 🔓 export ​

📄 duration.vx L59-61

vex
export fn nanoseconds(ns: i64): Duration

Parameters:

NameType
nsi64

Returns: Duration


minutes 🔓 export ​

📄 duration.vx L63-65

vex
export fn minutes(m: i64): Duration

Parameters:

NameType
mi64

Returns: Duration


hours 🔓 export ​

📄 duration.vx L67-69

vex
export fn hours(h: i64): Duration

Parameters:

NameType
hi64

Returns: Duration


fmt_int ​

📄 format.vxc L5-25

vex
fn fmt_int(val: i32, width: i32): string

Pad integer with zeros to width

Parameters:

NameType
vali32
widthi32

Returns: string


format_layout 🔓 export ​

📄 format.vxc L29-107

vex
export fn format_layout(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32, ns: i64, layout: string): string

Token-based formatting (Day.js style)

Supported tokens: YYYY, MM, DD, HH, mm, ss, SSS, Z

Parameters:

NameType
yi32
mi32
di32
hi32
mini32
si32
nsi64
layoutstring

Returns: string


now 🔓 export ​

📄 helpers.vx L13-15

vex
export fn now(): Time

Returns: Time


sleep 🔓 export ​

📄 helpers.vx L18-22

vex
export fn sleep(d: i64)

Parameters:

NameType
di64

sleep 🔓 export ​

📄 helpers.vx L25-30

vex
export fn sleep(d: Duration)

Parameters:

NameType
dDuration

getLocalOffset 🔓 export ​

📄 helpers.vx L33-35

vex
export fn getLocalOffset(): i64

Returns: i64


since 🔓 export ​

📄 helpers.vx L45-48

vex
export fn since(t: Time): Duration

Parameters:

NameType
tTime

Returns: Duration


until 🔓 export ​

📄 helpers.vx L51-54

vex
export fn until(t: Time): Duration

Parameters:

NameType
tTime

Returns: Duration


truncate 🔓 export ​

📄 helpers.vx L57-63

vex
export fn truncate(t: Time, d: Duration): Time

Parameters:

NameType
tTime
dDuration

Returns: Time


round 🔓 export ​

📄 helpers.vx L66-75

vex
export fn round(t: Time, d: Duration): Time

Parameters:

NameType
tTime
dDuration

Returns: Time


unix 🔓 export ​

📄 helpers.vx L78-80

vex
export fn unix(sec: i64, nsec: i64): Time

Parameters:

NameType
seci64
nseci64

Returns: Time


unix_seconds 🔓 export ​

📄 helpers.vx L83-83

vex
export fn unix_seconds(t: Time): i64

Parameters:

NameType
tTime

Returns: i64


unix_nanosecond 🔓 export ​

📄 helpers.vx L84-84

vex
export fn unix_nanosecond(t: Time): i64

Parameters:

NameType
tTime

Returns: i64


unix_milli 🔓 export ​

📄 helpers.vx L85-85

vex
export fn unix_milli(t: Time): i64

Parameters:

NameType
tTime

Returns: i64


unix_micro 🔓 export ​

📄 helpers.vx L86-86

vex
export fn unix_micro(t: Time): i64

Parameters:

NameType
tTime

Returns: i64


compare 🔓 export ​

📄 helpers.vx L89-91

vex
export fn compare(t1: Time, t2: Time): i32

Parameters:

NameType
t1Time
t2Time

Returns: i32


before 🔓 export ​

📄 helpers.vx L93-93

vex
export fn before(t1: Time, t2: Time): bool

Parameters:

NameType
t1Time
t2Time

Returns: bool


after 🔓 export ​

📄 helpers.vx L94-94

vex
export fn after(t1: Time, t2: Time): bool

Parameters:

NameType
t1Time
t2Time

Returns: bool


equal 🔓 export ​

📄 helpers.vx L95-95

vex
export fn equal(t1: Time, t2: Time): bool

Parameters:

NameType
t1Time
t2Time

Returns: bool


after 🔓 export ​

📄 helpers.vx L98-105

vex
export fn after(d: Duration): Channel<Time>

Parameters:

NameType
dDuration

Returns: Channel<Time>


weekday 🔓 export ​

📄 helpers.vx L108-108

vex
export fn weekday(t: Time): Weekday

Parameters:

NameType
tTime

Returns: Weekday


date 🔓 export ​

📄 helpers.vx L110-112

vex
export fn date(t: Time): (i32, Month, i32)

Parameters:

NameType
tTime

Returns: (i32, Month, i32)


clock 🔓 export ​

📄 helpers.vx L114-116

vex
export fn clock(t: Time): (i32, i32, i32)

Parameters:

NameType
tTime

Returns: (i32, i32, i32)


newTimer 🔓 export ​

📄 helpers.vx L139-141

vex
export fn newTimer(d: Duration): Timer

Parameters:

NameType
dDuration

Returns: Timer


newTicker 🔓 export ​

📄 helpers.vx L212-214

vex
export fn newTicker(d: Duration): Ticker

Parameters:

NameType
dDuration

Returns: Ticker


afterDuration 🔓 export ​

📄 helpers.vx L252-255

vex
export fn afterDuration(d: Duration): Time

Parameters:

NameType
dDuration

Returns: Time


tz_pad2 ​

📄 helpers.vx L261-264

vex
fn tz_pad2(n: i64): string

Parameters:

NameType
ni64

Returns: string


tz_pad4 ​

📄 helpers.vx L266-271

vex
fn tz_pad4(n: i64): string

Parameters:

NameType
ni64

Returns: string


formatInLocation 🔓 export ​

📄 helpers.vx L275-278

vex
export fn formatInLocation(t: Time, layout: str, loc: &Location): string

Parameters:

NameType
tTime
layoutstr
loc&Location

Returns: string


toRFC3339InLocation 🔓 export ​

📄 helpers.vx L281-306

vex
export fn toRFC3339InLocation(t: Time, loc: &Location): string

Parameters:

NameType
tTime
loc&Location

Returns: string


inLocation 🔓 export ​

📄 helpers.vx L310-313

vex
export fn inLocation(t: Time, loc: &Location): Time

Parameters:

NameType
tTime
loc&Location

Returns: Time


isDST 🔓 export ​

📄 helpers.vx L316-318

vex
export fn isDST(t: Time, loc: &Location): bool

Parameters:

NameType
tTime
loc&Location

Returns: bool


signedDurationBetween ​

📄 instant.vx L12-27

vex
fn signedDurationBetween(later: u64, earlier: u64): Duration

Parameters:

NameType
lateru64
earlieru64

Returns: Duration


utc 🔓 export ​

📄 lib.vx L5-5

vex
export fn utc(): Location

Returns: Location


local 🔓 export ​

📄 lib.vx L6-6

vex
export fn local(): Location

Returns: Location


fixed_zone 🔓 export ​

📄 lib.vx L7-7

vex
export fn fixed_zone(name: string, offset: i32): Location

Parameters:

NameType
namestring
offseti32

Returns: Location


load_location 🔓 export ​

📄 lib.vx L8-8

vex
export fn load_location(name: string): Result<Location, string>

Parameters:

NameType
namestring

Returns: Result<Location, string>


UTC 🔓 export ​

📄 location.vx L70-72

vex
export fn UTC(): Location

Returns: Location


Local 🔓 export ​

📄 location.vx L74-77

vex
export fn Local(): Location

Returns: Location


fixedZone 🔓 export ​

📄 location.vx L79-81

vex
export fn fixedZone(name: string, offsetSeconds: i64): Location

Parameters:

NameType
namestring
offsetSecondsi64

Returns: Location


loadLocation 🔓 export ​

📄 location.vx L90-110

vex
export fn loadLocation(name: string): Result<Location, string>

Parameters:

NameType
namestring

Returns: Result<Location, string>


EST 🔓 export ​

📄 location.vx L173-173

vex
export fn EST(): Location

Returns: Location


PST 🔓 export ​

📄 location.vx L174-174

vex
export fn PST(): Location

Returns: Location


CET 🔓 export ​

📄 location.vx L175-175

vex
export fn CET(): Location

Returns: Location


TRT 🔓 export ​

📄 location.vx L176-176

vex
export fn TRT(): Location

Returns: Location


JST 🔓 export ​

📄 location.vx L177-177

vex
export fn JST(): Location

Returns: Location


vex_tz_offset_at_shim 🔓 export ​

📄 native.linux.vxc L29-31

vex
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64


vex_tz_exists_shim 🔓 export ​

📄 native.linux.vxc L33-35

vex
export fn vex_tz_exists_shim(name: Ptr<u8>): i32

Parameters:

NameType
namePtr<u8>

Returns: i32


vex_get_local_offset 🔓 export ​

📄 native.linux.vxc L37-47

vex
export fn vex_get_local_offset(): i64

Returns: i64


vex_tz_offset_at_shim 🔓 export ​

📄 native.macos.vxc L29-31

vex
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64


vex_tz_exists_shim 🔓 export ​

📄 native.macos.vxc L33-35

vex
export fn vex_tz_exists_shim(name: Ptr<u8>): i32

Parameters:

NameType
namePtr<u8>

Returns: i32


vex_get_local_offset 🔓 export ​

📄 native.macos.vxc L37-47

vex
export fn vex_get_local_offset(): i64

Returns: i64


unsupportedTimeProvider ​

📄 native.vxc L12-14

vex
fn unsupportedTimeProvider(): None

Returns: None


vex_time_current_ns 🔓 export ​

📄 native.vxc L16-18

vex
export fn vex_time_current_ns(): u64

Returns: u64


vex_monotonic_ns 🔓 export ​

📄 native.vxc L20-22

vex
export fn vex_monotonic_ns(): u64

Returns: u64


vex_nanosleep 🔓 export ​

📄 native.vxc L24-26

vex
export fn vex_nanosleep(_ns: i64)

Parameters:

NameType
_nsi64

vex_get_local_offset 🔓 export ​

📄 native.vxc L28-30

vex
export fn vex_get_local_offset(): i64

Returns: i64


vex_tz_offset_at_shim 🔓 export ​

📄 native.vxc L32-34

vex
export fn vex_tz_offset_at_shim(_name: Ptr<u8>, _unixSec: i64): i64

Parameters:

NameType
_namePtr<u8>
_unixSeci64

Returns: i64


vex_tz_exists_shim 🔓 export ​

📄 native.vxc L36-38

vex
export fn vex_tz_exists_shim(_name: Ptr<u8>): i32

Parameters:

NameType
_namePtr<u8>

Returns: i32


vex_tz_offset_at_shim 🔓 export ​

📄 native.windows.vxc L35-37

vex
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64


vex_tz_exists_shim 🔓 export ​

📄 native.windows.vxc L39-41

vex
export fn vex_tz_exists_shim(name: Ptr<u8>): i32

Parameters:

NameType
namePtr<u8>

Returns: i32


vex_get_local_offset 🔓 export ​

📄 native.windows.vxc L43-77

vex
export fn vex_get_local_offset(): i64

Returns: i64


isDigit ​

📄 parse.vx L17-19

vex
fn isDigit(c: u8): bool

Parameters:

NameType
cu8

Returns: bool


scan_int_at ​

📄 parse.vx L21-35

vex
fn scan_int_at(s: str, pos: usize, digits: i32): ScanResult

Parameters:

NameType
sstr
posusize
digitsi32

Returns: ScanResult


scanRfc2 ​

📄 parse.vx L40-47

vex
fn scanRfc2(s: str, pos: usize): i32

Parameters:

NameType
sstr
posusize

Returns: i32


scanRfc4 ​

📄 parse.vx L49-61

vex
fn scanRfc4(s: str, pos: usize): i32

Parameters:

NameType
sstr
posusize

Returns: i32


scan_nanos_at ​

📄 parse.vx L63-77

vex
fn scan_nanos_at(s: str, pos: usize): ScanResult64

Parameters:

NameType
sstr
posusize

Returns: ScanResult64


daysFromCivil ​

📄 parse.vx L83-93

vex
fn daysFromCivil(year: i32, month: i32, day: i32): i64

Parameters:

NameType
yeari32
monthi32
dayi32

Returns: i64


validDateTime ​

📄 parse.vx L95-102

vex
fn validDateTime(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32): bool

Parameters:

NameType
yi32
mi32
di32
hi32
mini32
si32

Returns: bool


partsToNs ​

📄 parse.vx L104-128

vex
fn partsToNs(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32, ns: i64, offsetSeconds: i32): Option<i64>

Parameters:

NameType
yi32
mi32
di32
hi32
mini32
si32
nsi64
offsetSecondsi32

Returns: Option<i64>


parse 🔓 export ​

📄 parse.vx L130-183

vex
export fn parse(layout: str, input: str): Result<Time, string>

Usage contract: Parses UTC fields and rejects trailing input or invalid dates. Omitted fields default to 1970-01-01 00:00:00. Use parse_rfc3339 for offsets/fractional seconds; parse is not format autodetection.

Parameters:

NameTypeDescription
layoutstrExplicit YYYY/MM/DD/HH/mm/ss token layout with literal separators
inputstrDate/time text to match completely

Returns: Result<Time, string>


parse_rfc3339 🔓 export ​

📄 parse.vx L185-241

vex
export fn parse_rfc3339(input: str): Result<Time, string>

Parameters:

NameType
inputstr

Returns: Result<Time, string>


parse_duration 🔓 export ​

📄 parse.vx L243-326

vex
export fn parse_duration(input: str): Result<Duration, string>

Parameters:

NameType
inputstr

Returns: Result<Duration, string>


days_in_month 🔓 export ​

📄 time_type.vx L14-22

vex
export fn days_in_month(m: i32, year: i32): i32

Parameters:

NameType
mi32
yeari32

Returns: i32


ns_to_datetime 🔓 export ​

📄 time_type.vx L47-72

vex
export fn ns_to_datetime(ns: i64): DateTimeParts

Parameters:

NameType
nsi64

Returns: DateTimeParts


floor_div ​

📄 time_type.vx L110-117

vex
fn floor_div(value: i64, unit: i64): i64

Parameters:

NameType
valuei64
uniti64

Returns: i64


add 🔓 export ​

📄 time_type.vx L246-248

vex
export fn add(t: Time, d: Duration): Time

Parameters:

NameType
tTime
dDuration

Returns: Time


sub 🔓 export ​

📄 time_type.vx L250-252

vex
export fn sub(t1: Time, t2: Time): Duration

Parameters:

NameType
t1Time
t2Time

Returns: Duration


write_padded_int ​

📄 time_type.vx L344-356

vex
fn write_padded_int(sb: &StringBuilder!, val: i64, width: i32)

Parameters:

NameType
sb&StringBuilder!
vali64
widthi32

expect ​

📄 basic.test.vx L11-14

vex
fn expect(cond: bool, code: i32): i32

Parameters:

NameType
condbool
codei32

Returns: i32


test_monotonic ​

📄 basic.test.vx L16-20

vex
fn test_monotonic(): i32

Returns: i32


test_now_since_until_and_add ​

📄 basic.test.vx L22-29

vex
fn test_now_since_until_and_add(): i32

Returns: i32


test_parse_duration ​

📄 basic.test.vx L31-42

vex
fn test_parse_duration(): i32

Returns: i32


test_rfc3339_parse_components ​

📄 basic.test.vx L44-55

vex
fn test_rfc3339_parse_components(): i32

Returns: i32


test_unix_helpers ​

📄 basic.test.vx L57-65

vex
fn test_unix_helpers(): i32

Returns: i32


test_rfc3339_millisecond_writer ​

📄 basic.test.vx L67-73

vex
fn test_rfc3339_millisecond_writer(): i32

Returns: i32


test_time_checked_and_saturating_boundaries ​

📄 basic.test.vx L75-98

vex
fn test_time_checked_and_saturating_boundaries(): i32

Returns: i32


test_compare_and_order ​

📄 basic.test.vx L100-108

vex
fn test_compare_and_order(): i32

Returns: i32


test_truncate_and_round ​

📄 basic.test.vx L110-116

vex
fn test_truncate_and_round(): i32

Returns: i32


test_after_channel ​

📄 basic.test.vx L118-128

vex
fn test_after_channel(): i32

Returns: i32


test_duration_overflow_policies ​

📄 basic.test.vx L130-149

vex
fn test_duration_overflow_policies(): i32

Returns: i32


test_instant_is_typed_and_monotonic ​

📄 basic.test.vx L151-159

vex
fn test_instant_is_typed_and_monotonic(): i32

Returns: i32


test_rfc3339_offsets_and_fraction ​

📄 basic.test.vx L161-179

vex
fn test_rfc3339_offsets_and_fraction(): i32

Returns: i32


test_rfc3339_validation_and_i64_boundaries ​

📄 basic.test.vx L181-211

vex
fn test_rfc3339_validation_and_i64_boundaries(): i32

Returns: i32


test_duration_fraction_sign_units_and_boundaries ​

📄 basic.test.vx L213-250

vex
fn test_duration_fraction_sign_units_and_boundaries(): i32

Returns: i32


bench_instant_now ​

📄 bench.test.vx L5-7

vex
fn bench_instant_now(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_time_now ​

📄 bench.test.vx L9-11

vex
fn bench_time_now(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_time_checked_add ​

📄 bench.test.vx L13-19

vex
fn bench_time_checked_add(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_duration_checked_arithmetic ​

📄 bench.test.vx L21-27

vex
fn bench_duration_checked_arithmetic(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_parse_rfc3339_utc ​

📄 bench.test.vx L29-32

vex
fn bench_parse_rfc3339_utc(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_parse_rfc3339_offset ​

📄 bench.test.vx L34-37

vex
fn bench_parse_rfc3339_offset(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_parse_duration_compound ​

📄 bench.test.vx L39-42

vex
fn bench_parse_duration_compound(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_duration_to_string ​

📄 bench.test.vx L44-47

vex
fn bench_duration_to_string(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

bench_time_to_string ​

📄 bench.test.vx L49-52

vex
fn bench_time_to_string(b: &BenchCtx!)

Parameters:

NameType
b&BenchCtx!

test_now_and_monotonic ​

📄 comprehensive.test.vx L5-11

vex
fn test_now_and_monotonic(): i32

Returns: i32


test_unix_construction ​

📄 comprehensive.test.vx L13-29

vex
fn test_unix_construction(): i32

Returns: i32


test_parse_duration_basic ​

📄 comprehensive.test.vx L31-46

vex
fn test_parse_duration_basic(): i32

Returns: i32


test_duration_constants ​

📄 comprehensive.test.vx L48-57

vex
fn test_duration_constants(): i32

Returns: i32


test_arithmetic ​

📄 comprehensive.test.vx L59-70

vex
fn test_arithmetic(): i32

Returns: i32


test_since_until ​

📄 comprehensive.test.vx L72-81

vex
fn test_since_until(): i32

Returns: i32


test_rfc3339_parse ​

📄 comprehensive.test.vx L83-96

vex
fn test_rfc3339_parse(): i32

Returns: i32


test_zones ​

📄 comprehensive.test.vx L98-107

vex
fn test_zones(): i32

Returns: i32


test_date_components ​

📄 comprehensive.test.vx L109-116

vex
fn test_date_components(): i32

Returns: i32


test_clock_components ​

📄 comprehensive.test.vx L118-125

vex
fn test_clock_components(): i32

Returns: i32


test_weekday_yearday ​

📄 comprehensive.test.vx L127-133

vex
fn test_weekday_yearday(): i32

Returns: i32


test_comparisons ​

📄 comprehensive.test.vx L135-146

vex
fn test_comparisons(): i32

Returns: i32


test_truncate_round ​

📄 comprehensive.test.vx L148-158

vex
fn test_truncate_round(): i32

Returns: i32


test_unix_helpers ​

📄 comprehensive.test.vx L160-168

vex
fn test_unix_helpers(): i32

Returns: i32


test_start_end_of_boundaries ​

📄 comprehensive.test.vx L170-221

vex
fn test_start_end_of_boundaries(): i32

Returns: i32


test_timer_ticker_phase2 ​

📄 comprehensive.test.vx L223-256

vex
fn test_timer_ticker_phase2(): i32

Returns: i32


test_after_channel_api ​

📄 comprehensive.test.vx L258-268

vex
fn test_after_channel_api(): i32

Returns: i32


test_load_location_dst_rules ​

📄 comprehensive.test.vx L270-314

vex
fn test_load_location_dst_rules(): i32

Returns: i32


test_dst_transition_instants ​

📄 comprehensive.test.vx L316-393

vex
fn test_dst_transition_instants(): i32

Returns: i32


test_location_clone_preserves_heap_backed_name ​

📄 ownership.test.vx L3-14

vex
fn test_location_clone_preserves_heap_backed_name()

test_duration_tostring ​

📄 phase3.test.vx L10-39

vex
fn test_duration_tostring(): i32

Returns: i32


test_duration_neg_cmp ​

📄 phase3.test.vx L45-62

vex
fn test_duration_neg_cmp(): i32

Returns: i32


test_add_date ​

📄 phase3.test.vx L68-115

vex
fn test_add_date(): i32

Returns: i32


test_in_location ​

📄 phase3.test.vx L121-156

vex
fn test_in_location(): i32

Returns: i32


test_rfc3339_with_offset ​

📄 phase3.test.vx L162-206

vex
fn test_rfc3339_with_offset(): i32

Returns: i32


test_is_dst ​

📄 phase3.test.vx L212-248

vex
fn test_is_dst(): i32

Returns: i32


test_extra_timezone_aliases ​

📄 phase3.test.vx L254-339

vex
fn test_extra_timezone_aliases(): i32

Returns: i32


test_au_sydney_dst ​

📄 phase3.test.vx L345-381

vex
fn test_au_sydney_dst(): i32

Returns: i32


test_time_format ​

📄 phase3.test.vx L387-404

vex
fn test_time_format(): i32

Returns: i32


main 🔓 export ​

📄 unit_test.vx L3-35

vex
export fn main(): i32

Returns: i32


Methods ​

Duration.seconds 🔓 export ​

📄 duration.vx L22-24

vex
export fn Duration.seconds(s: i64): Duration

Usage contract: Scales to signed i64 nanoseconds using checked multiplication and panics on overflow. Duration is elapsed time, not a timezone-aware calendar interval.

Parameters:

NameTypeDescription
si64Signed duration count in seconds

Returns: Duration


Duration.milliseconds 🔓 export ​

📄 duration.vx L26-28

vex
export fn Duration.milliseconds(ms: i64): Duration

Parameters:

NameType
msi64

Returns: Duration


Duration.microseconds 🔓 export ​

📄 duration.vx L30-32

vex
export fn Duration.microseconds(us: i64): Duration

Parameters:

NameType
usi64

Returns: Duration


Duration.nanoseconds 🔓 export ​

📄 duration.vx L34-36

vex
export fn Duration.nanoseconds(ns: i64): Duration

Parameters:

NameType
nsi64

Returns: Duration


Duration.minutes 🔓 export ​

📄 duration.vx L38-40

vex
export fn Duration.minutes(m: i64): Duration

Parameters:

NameType
mi64

Returns: Duration


Duration.hours 🔓 export ​

📄 duration.vx L42-44

vex
export fn Duration.hours(h: i64): Duration

Parameters:

NameType
hi64

Returns: Duration


asSeconds 🔓 export ​

📄 duration.vx L75-77

vex
export fn (self: &Duration) asSeconds(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


asMillis 🔓 export ​

📄 duration.vx L79-81

vex
export fn (self: &Duration) asMillis(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


asMicros 🔓 export ​

📄 duration.vx L83-85

vex
export fn (self: &Duration) asMicros(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


asNanos 🔓 export ​

📄 duration.vx L87-89

vex
export fn (self: &Duration) asNanos(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


asMinutes 🔓 export ​

📄 duration.vx L91-93

vex
export fn (self: &Duration) asMinutes(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


asHours 🔓 export ​

📄 duration.vx L95-97

vex
export fn (self: &Duration) asHours(): i64

Receiver: self: &Duration (immutable reference)

Returns: i64


add 🔓 export ​

📄 duration.vx L103-108

vex
export fn (self: &Duration) add(other: Duration): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Duration


sub 🔓 export ​

📄 duration.vx L110-115

vex
export fn (self: &Duration) sub(other: Duration): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Duration


mul 🔓 export ​

📄 duration.vx L117-122

vex
export fn (self: &Duration) mul(n: i64): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
ni64

Returns: Duration


div 🔓 export ​

📄 duration.vx L124-129

vex
export fn (self: &Duration) div(n: i64): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
ni64

Returns: Duration


checkedAdd 🔓 export ​

📄 duration.vx L131-137

vex
export fn (self: &Duration) checkedAdd(other: Duration): Option<Duration>

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Option<Duration>


checkedSub 🔓 export ​

📄 duration.vx L139-145

vex
export fn (self: &Duration) checkedSub(other: Duration): Option<Duration>

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Option<Duration>


checkedMul 🔓 export ​

📄 duration.vx L147-160

vex
export fn (self: &Duration) checkedMul(n: i64): Option<Duration>

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
ni64

Returns: Option<Duration>


checkedDiv 🔓 export ​

📄 duration.vx L162-166

vex
export fn (self: &Duration) checkedDiv(n: i64): Option<Duration>

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
ni64

Returns: Option<Duration>


saturatingAdd 🔓 export ​

📄 duration.vx L168-176

vex
export fn (self: &Duration) saturatingAdd(other: Duration): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Duration


saturatingSub 🔓 export ​

📄 duration.vx L178-186

vex
export fn (self: &Duration) saturatingSub(other: Duration): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
otherDuration

Returns: Duration


saturatingMul 🔓 export ​

📄 duration.vx L188-198

vex
export fn (self: &Duration) saturatingMul(n: i64): Duration

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
ni64

Returns: Duration


isZero 🔓 export ​

📄 duration.vx L204-206

vex
export fn (self: &Duration) isZero(): bool

Receiver: self: &Duration (immutable reference)

Returns: bool


isNegative 🔓 export ​

📄 duration.vx L208-210

vex
export fn (self: &Duration) isNegative(): bool

Receiver: self: &Duration (immutable reference)

Returns: bool


abs 🔓 export ​

📄 duration.vx L212-216

vex
export fn (self: &Duration) abs(): Duration

Receiver: self: &Duration (immutable reference)

Returns: Duration


saturatingAbs 🔓 export ​

📄 duration.vx L218-223

vex
export fn (self: &Duration) saturatingAbs(): Duration

Receiver: self: &Duration (immutable reference)

Returns: Duration


clone 🔓 export ​

📄 duration.vx L229-231

vex
export fn (self: &Duration) clone(): Duration

Receiver: self: &Duration (immutable reference)

Returns: Duration


neg 🔓 export ​

📄 duration.vx L233-236

vex
export fn (self: &Duration) neg(): Duration

Receiver: self: &Duration (immutable reference)

Returns: Duration


cmp 🔓 export ​

📄 duration.vx L238-242

vex
export fn (self: &Duration) cmp(other: &Duration): i32

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: i32


op== 🔓 export ​

📄 duration.vx L244-244

vex
export fn (self: &Duration) op==(other: &Duration): bool

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: bool


op< 🔓 export ​

📄 duration.vx L245-245

vex
export fn (self: &Duration) op<(other: &Duration): bool

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: bool


op> 🔓 export ​

📄 duration.vx L246-246

vex
export fn (self: &Duration) op>(other: &Duration): bool

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: bool


op<= 🔓 export ​

📄 duration.vx L247-247

vex
export fn (self: &Duration) op<=(other: &Duration): bool

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: bool


op>= 🔓 export ​

📄 duration.vx L248-248

vex
export fn (self: &Duration) op>=(other: &Duration): bool

Receiver: self: &Duration (immutable reference)

Parameters:

NameType
other&Duration

Returns: bool


toString 🔓 export ​

📄 duration.vx L251-275

vex
export fn (self: &Duration) toString(): string

Receiver: self: &Duration (immutable reference)

Returns: string


Timer.new 🔓 export ​

📄 helpers.vx L129-137

vex
export fn Timer.new(d: Duration): Timer

Parameters:

NameType
dDuration

Returns: Timer


expired 🔓 export ​

📄 helpers.vx L143-151

vex
export fn (self: &Timer) expired(): bool

Receiver: self: &Timer (immutable reference)

Returns: bool


poll 🔓 export ​

📄 helpers.vx L153-166

vex
export fn (self: &Timer!) poll(): bool

Receiver: self: &Timer! (mutable reference)

Returns: bool


reset 🔓 export ​

📄 helpers.vx L168-173

vex
export fn (self: &Timer!) reset(d: Duration)

Receiver: self: &Timer! (mutable reference)

Parameters:

NameType
dDuration

stop 🔓 export ​

📄 helpers.vx L175-177

vex
export fn (self: &Timer!) stop()

Receiver: self: &Timer! (mutable reference)


wait 🔓 export ​

📄 helpers.vx L179-193

vex
export fn (self: &Timer!) wait(): Time

Receiver: self: &Timer! (mutable reference)

Returns: Time


Ticker.new 🔓 export ​

📄 helpers.vx L202-210

vex
export fn Ticker.new(d: Duration): Ticker

Parameters:

NameType
dDuration

Returns: Ticker


tick 🔓 export ​

📄 helpers.vx L216-237

vex
export fn (self: &Ticker!) tick(): bool

Receiver: self: &Ticker! (mutable reference)

Returns: bool


reset 🔓 export ​

📄 helpers.vx L239-245

vex
export fn (self: &Ticker!) reset(d: Duration)

Receiver: self: &Ticker! (mutable reference)

Parameters:

NameType
dDuration

stop 🔓 export ​

📄 helpers.vx L247-249

vex
export fn (self: &Ticker!) stop()

Receiver: self: &Ticker! (mutable reference)


Instant.now 🔓 export ​

📄 instant.vx L29-31

vex
export fn Instant.now(): Instant

Returns: Instant


clone 🔓 export ​

📄 instant.vx L33-35

vex
export fn (self: &Instant) clone(): Instant

Receiver: self: &Instant (immutable reference)

Returns: Instant


asNanos 🔓 export ​

📄 instant.vx L39-41

vex
export fn (self: &Instant) asNanos(): u64

Process-local clock reading for diagnostics and native interop. It has no

relationship to Unix time and must not be persisted across process runs.

Receiver: self: &Instant (immutable reference)

Returns: u64


durationSince 🔓 export ​

📄 instant.vx L44-46

vex
export fn (self: &Instant) durationSince(earlier: Instant): Duration

Signed difference with saturation at Duration's representable limits.

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
earlierInstant

Returns: Duration


saturatingDurationSince 🔓 export ​

📄 instant.vx L49-52

vex
export fn (self: &Instant) saturatingDurationSince(earlier: Instant): Duration

Non-negative difference; clock anomalies or reversed operands yield zero.

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
earlierInstant

Returns: Duration


elapsed 🔓 export ​

📄 instant.vx L54-56

vex
export fn (self: &Instant) elapsed(): Duration

Receiver: self: &Instant (immutable reference)

Returns: Duration


checkedAdd 🔓 export ​

📄 instant.vx L58-73

vex
export fn (self: &Instant) checkedAdd(duration: Duration): Option<Instant>

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
durationDuration

Returns: Option<Instant>


checkedSub 🔓 export ​

📄 instant.vx L75-90

vex
export fn (self: &Instant) checkedSub(duration: Duration): Option<Instant>

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
durationDuration

Returns: Option<Instant>


saturatingAdd 🔓 export ​

📄 instant.vx L92-100

vex
export fn (self: &Instant) saturatingAdd(duration: Duration): Instant

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
durationDuration

Returns: Instant


saturatingSub 🔓 export ​

📄 instant.vx L102-110

vex
export fn (self: &Instant) saturatingSub(duration: Duration): Instant

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
durationDuration

Returns: Instant


op== 🔓 export ​

📄 instant.vx L112-112

vex
export fn (self: &Instant) op==(other: &Instant): bool

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
other&Instant

Returns: bool


op< 🔓 export ​

📄 instant.vx L113-113

vex
export fn (self: &Instant) op<(other: &Instant): bool

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
other&Instant

Returns: bool


op> 🔓 export ​

📄 instant.vx L114-114

vex
export fn (self: &Instant) op>(other: &Instant): bool

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
other&Instant

Returns: bool


op<= 🔓 export ​

📄 instant.vx L115-115

vex
export fn (self: &Instant) op<=(other: &Instant): bool

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
other&Instant

Returns: bool


op>= 🔓 export ​

📄 instant.vx L116-116

vex
export fn (self: &Instant) op>=(other: &Instant): bool

Receiver: self: &Instant (immutable reference)

Parameters:

NameType
other&Instant

Returns: bool


Location.utc 🔓 export ​

📄 location.vx L34-36

vex
export fn Location.utc(): Location

Returns: Location


Location.local 🔓 export ​

📄 location.vx L38-41

vex
export fn Location.local(): Location

Returns: Location


Location.fixedZone 🔓 export ​

📄 location.vx L43-45

vex
export fn Location.fixedZone(name: string, offsetSeconds: i64): Location

Parameters:

NameType
namestring
offsetSecondsi64

Returns: Location


Location.load 🔓 export ​

📄 location.vx L47-67

vex
export fn Location.load(name: string): Result<Location, string>

Parameters:

NameType
namestring

Returns: Result<Location, string>


offset 🔓 export ​

📄 location.vx L117-119

vex
export fn (self: &Location) offset(): i64

Standard (base) offset in seconds.

Receiver: self: &Location (immutable reference)

Returns: i64


offsetAtUnix 🔓 export ​

📄 location.vx L124-131

vex
export fn (self: &Location) offsetAtUnix(unixSec: i64): i64

Actual UTC offset at an arbitrary Unix timestamp.

For fixed zones identical to self.offsetSeconds. For IANA dynamic zones calls into the TZif parser.

Receiver: self: &Location (immutable reference)

Parameters:

NameType
unixSeci64

Returns: i64


offsetAt 🔓 export ​

📄 location.vx L134-136

vex
export fn (self: &Location) offsetAt(t: Time): i64

Offset at a Time instant.

Receiver: self: &Location (immutable reference)

Parameters:

NameType
tTime

Returns: i64


offsetHours 🔓 export ​

📄 location.vx L139-141

vex
export fn (self: &Location) offsetHours(): i32

Offset in whole hours.

Receiver: self: &Location (immutable reference)

Returns: i32


clone 🔓 export ​

📄 location.vx L144-150

vex
export fn (self: &Location) clone(): Location

Clone.

Receiver: self: &Location (immutable reference)

Returns: Location


toString 🔓 export ​

📄 location.vx L153-167

vex
export fn (self: &Location) toString(): string

Display: "America/New_York (UTC-5)"

Receiver: self: &Location (immutable reference)

Returns: string


time ​

📄 native.linux.vxc L5-5

vex
extern fn time(t: Ptr<i64!>): i64;

Parameters:

NameType
tPtr<i64!>

Returns: i64;


localtime_r ​

📄 native.linux.vxc L6-6

vex
extern fn localtime_r(timep: Ptr<i64>, result: Ptr<Opaque!>): Ptr<Opaque>;

Parameters:

NameType
timepPtr<i64>
resultPtr<Opaque!>

Returns: Ptr<Opaque>;


vex_tz_offset_at ​

📄 native.linux.vxc L25-25

vex
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64;


vex_tz_exists ​

📄 native.linux.vxc L26-26

vex
extern fn vex_tz_exists(name: Ptr<u8>): i32;

Parameters:

NameType
namePtr<u8>

Returns: i32;


time ​

📄 native.macos.vxc L5-5

vex
extern fn time(t: Ptr<i64!>): i64;

Parameters:

NameType
tPtr<i64!>

Returns: i64;


localtime_r ​

📄 native.macos.vxc L6-6

vex
extern fn localtime_r(timep: Ptr<i64>, result: Ptr<Opaque!>): Ptr<Opaque>;

Parameters:

NameType
timepPtr<i64>
resultPtr<Opaque!>

Returns: Ptr<Opaque>;


vex_tz_offset_at ​

📄 native.macos.vxc L25-25

vex
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64;


vex_tz_exists ​

📄 native.macos.vxc L26-26

vex
extern fn vex_tz_exists(name: Ptr<u8>): i32;

Parameters:

NameType
namePtr<u8>

Returns: i32;


GetTimeZoneInformation ​

📄 native.windows.vxc L27-27

vex
extern fn GetTimeZoneInformation(lpTimeZoneInformation: Ptr<TIME_ZONE_INFORMATION!>): u32;

Parameters:

NameType
lpTimeZoneInformationPtr<TIME_ZONE_INFORMATION!>

Returns: u32;


vex_tz_offset_at ​

📄 native.windows.vxc L31-31

vex
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;

Parameters:

NameType
namePtr<u8>
unix_seci64

Returns: i64;


vex_tz_exists ​

📄 native.windows.vxc L32-32

vex
extern fn vex_tz_exists(name: Ptr<u8>): i32;

Parameters:

NameType
namePtr<u8>

Returns: i32;


vex_time_current_ns ​

📄 runtime.vxc L5-5

vex
extern fn vex_time_current_ns(): u64;

Returns: u64;


vex_monotonic_ns ​

📄 runtime.vxc L6-6

vex
extern fn vex_monotonic_ns(): u64;

Returns: u64;


vex_nanosleep ​

📄 runtime.vxc L7-7

vex
extern fn vex_nanosleep(nanos: i64)

Parameters:

NameType
nanosi64

year 🔓 export ​

📄 time_type.vx L39-39

vex
export fn (self: &DateTimeParts) year(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


month 🔓 export ​

📄 time_type.vx L40-40

vex
export fn (self: &DateTimeParts) month(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


day 🔓 export ​

📄 time_type.vx L41-41

vex
export fn (self: &DateTimeParts) day(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


hour 🔓 export ​

📄 time_type.vx L42-42

vex
export fn (self: &DateTimeParts) hour(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


minute 🔓 export ​

📄 time_type.vx L43-43

vex
export fn (self: &DateTimeParts) minute(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


second 🔓 export ​

📄 time_type.vx L44-44

vex
export fn (self: &DateTimeParts) second(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


weekday 🔓 export ​

📄 time_type.vx L45-45

vex
export fn (self: &DateTimeParts) weekday(): i32

Receiver: self: &DateTimeParts (immutable reference)

Returns: i32


Time.now 🔓 export ​

📄 time_type.vx L83-86

vex
export fn Time.now(): Time

Returns: Time


Time.unix 🔓 export ​

📄 time_type.vx L88-93

vex
export fn Time.unix(sec: i64, nsec: i64): Time

Parameters:

NameType
seci64
nseci64

Returns: Time


Time.checkedUnix 🔓 export ​

📄 time_type.vx L96-100

vex
export fn Time.checkedUnix(sec: i64, nsec: i64): Option<Time>

Usage contract: Returns None when the normalized timestamp cannot fit signed i64 nanoseconds. Use Time.unix only when overflow panic is the intended policy.

Constructs Unix time while normalizing an arbitrary nanosecond offset.

Parameters:

NameTypeDescription
seci64Signed Unix seconds
nseci64Signed additional nanoseconds, normalized with seconds

Returns: Option<Time>


Time.fromUnixNanos 🔓 export ​

📄 time_type.vx L103-105

vex
export fn Time.fromUnixNanos(ns: i64): Time

Constructs an absolute time from nanoseconds since the Unix epoch.

Parameters:

NameType
nsi64

Returns: Time


clone 🔓 export ​

📄 time_type.vx L119-121

vex
export fn (self: &Time) clone(): Time

Receiver: self: &Time (immutable reference)

Returns: Time


cmp 🔓 export ​

📄 time_type.vx L123-127

vex
export fn (self: &Time) cmp(other: &Time): i32

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: i32


op== 🔓 export ​

📄 time_type.vx L129-129

vex
export fn (self: &Time) op==(other: &Time): bool

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: bool


op< 🔓 export ​

📄 time_type.vx L130-130

vex
export fn (self: &Time) op<(other: &Time): bool

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: bool


op> 🔓 export ​

📄 time_type.vx L131-131

vex
export fn (self: &Time) op>(other: &Time): bool

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: bool


op<= 🔓 export ​

📄 time_type.vx L132-132

vex
export fn (self: &Time) op<=(other: &Time): bool

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: bool


op>= 🔓 export ​

📄 time_type.vx L133-133

vex
export fn (self: &Time) op>=(other: &Time): bool

Receiver: self: &Time (immutable reference)

Parameters:

NameType
other&Time

Returns: bool


toString 🔓 export ​

📄 time_type.vx L135-152

vex
export fn (self: &Time) toString(): string

Receiver: self: &Time (immutable reference)

Returns: string


writeRFC3339MillisTo 🔓 export ​

📄 time_type.vx L159-179

vex
export fn (self: &Time) writeRFC3339MillisTo(out: &StringBuilder!)

Append the UTC timestamp in fixed-width RFC 3339 millisecond form.

This avoids the temporary owned timestamp created by toString() and is intended for serializers, log encoders and protocol writers that already own a reusable StringBuilder.

Receiver: self: &Time (immutable reference)

Parameters:

NameType
out&StringBuilder!

unix 🔓 export ​

📄 time_type.vx L181-183

vex
export fn (self: &Time) unix(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


unixNano 🔓 export ​

📄 time_type.vx L186-188

vex
export fn (self: &Time) unixNano(): i64

Total nanoseconds elapsed since the Unix epoch.

Receiver: self: &Time (immutable reference)

Returns: i64


unixMilli 🔓 export ​

📄 time_type.vx L191-193

vex
export fn (self: &Time) unixMilli(): i64

Total milliseconds elapsed since the Unix epoch, rounded toward the past.

Receiver: self: &Time (immutable reference)

Returns: i64


unixMicro 🔓 export ​

📄 time_type.vx L196-198

vex
export fn (self: &Time) unixMicro(): i64

Total microseconds elapsed since the Unix epoch, rounded toward the past.

Receiver: self: &Time (immutable reference)

Returns: i64


nanosecond 🔓 export ​

📄 time_type.vx L201-207

vex
export fn (self: &Time) nanosecond(): i64

Nanosecond offset within the current Unix second (0..999_999_999).

Receiver: self: &Time (immutable reference)

Returns: i64


checkedAdd 🔓 export ​

📄 time_type.vx L209-213

vex
export fn (self: &Time) checkedAdd(d: Duration): Option<Time>

Receiver: self: &Time (immutable reference)

Parameters:

NameType
dDuration

Returns: Option<Time>


add 🔓 export ​

📄 time_type.vx L215-220

vex
export fn (self: &Time) add(d: Duration): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
dDuration

Returns: Time


saturatingAdd 🔓 export ​

📄 time_type.vx L222-230

vex
export fn (self: &Time) saturatingAdd(d: Duration): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
dDuration

Returns: Time


checkedDurationSince 🔓 export ​

📄 time_type.vx L232-236

vex
export fn (self: &Time) checkedDurationSince(earlier: Time): Option<Duration>

Receiver: self: &Time (immutable reference)

Parameters:

NameType
earlierTime

Returns: Option<Duration>


durationSince 🔓 export ​

📄 time_type.vx L238-243

vex
export fn (self: &Time) durationSince(earlier: Time): Duration

Receiver: self: &Time (immutable reference)

Parameters:

NameType
earlierTime

Returns: Duration


year 🔓 export ​

📄 time_type.vx L256-259

vex
export fn (self: &Time) year(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


month 🔓 export ​

📄 time_type.vx L261-276

vex
export fn (self: &Time) month(): Month

Receiver: self: &Time (immutable reference)

Returns: Month


day 🔓 export ​

📄 time_type.vx L278-281

vex
export fn (self: &Time) day(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


hour 🔓 export ​

📄 time_type.vx L283-286

vex
export fn (self: &Time) hour(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


minute 🔓 export ​

📄 time_type.vx L288-291

vex
export fn (self: &Time) minute(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


second 🔓 export ​

📄 time_type.vx L293-296

vex
export fn (self: &Time) second(): i64

Receiver: self: &Time (immutable reference)

Returns: i64


weekday 🔓 export ​

📄 time_type.vx L298-308

vex
export fn (self: &Time) weekday(): Weekday

Receiver: self: &Time (immutable reference)

Returns: Weekday


addDate 🔓 export ​

📄 time_type.vx L312-336

vex
export fn (self: &Time) addDate(years: i32, months: i32, days: i32): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
yearsi32
monthsi32
daysi32

Returns: Time


withOffset 🔓 export ​

📄 time_type.vx L340-342

vex
export fn (self: &Time) withOffset(offsetSec: i64): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
offsetSeci64

Returns: Time


formatWithOffset 🔓 export ​

📄 time_type.vx L361-403

vex
export fn (self: &Time) formatWithOffset(layout: str, offsetSec: i64): string

Receiver: self: &Time (immutable reference)

Parameters:

NameType
layoutstr
offsetSeci64

Returns: string


format 🔓 export ​

📄 time_type.vx L405-407

vex
export fn (self: &Time) format(layout: str): string

Receiver: self: &Time (immutable reference)

Parameters:

NameType
layoutstr

Returns: string


startOf 🔓 export ​

📄 time_type.vx L413-457

vex
export fn (self: &Time) startOf(unit: str): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
unitstr

Returns: Time


endOf 🔓 export ​

📄 time_type.vx L459-497

vex
export fn (self: &Time) endOf(unit: str): Time

Receiver: self: &Time (immutable reference)

Parameters:

NameType
unitstr

Returns: Time



Generated by vex-doc v2.0 • 2026-10-28

Released under the MIT License.