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
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.vxL33-33
export const NANOSECOND: i64=1;MICROSECOND 🔓 export
📄
constants.vxL34-34
export const MICROSECOND: i64=1000 * NANOSECOND;MILLISECOND 🔓 export
📄
constants.vxL35-35
export const MILLISECOND: i64=1000 * MICROSECOND;SECOND 🔓 export
📄
constants.vxL36-36
export const SECOND: i64=1000 * MILLISECOND;MINUTE 🔓 export
📄
constants.vxL37-37
export const MINUTE: i64=60 * SECOND;HOUR 🔓 export
📄
constants.vxL38-38
export const HOUR: i64=60 * MINUTE;DAY 🔓 export
📄
constants.vxL39-39
export const DAY: i64=24 * HOUR;RFC3339 🔓 export
📄
constants.vxL42-42
export const RFC3339: string="2006-01-02T15:04:05Z07:00";Structs
DateParts 🔓 export
📄
conversions.vxL7-12
export struct DatePartsFields:
| Name | Type | Access |
|---|---|---|
y | i32 | 🔒 readonly |
m | i32 | 🔒 readonly |
d | i32 | 🔒 readonly |
Duration 🔓 export
📄
duration.vxL5-8
export struct DurationImplements: Display & Clone & Copy & Eq & Ord
Fields:
| Name | Type | Access |
|---|---|---|
ns | i64 | 🔒 readonly |
Methods:
| Method | Signature | Description |
|---|---|---|
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.vxL122-127
export struct TimerFields:
| Name | Type | Access |
|---|---|---|
deadline | Instant | 🔒 private |
fired | bool | 🔒 private |
active | bool | 🔒 private |
Methods:
| Method | Signature | Description |
|---|---|---|
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.vxL195-200
export struct TickerFields:
| Name | Type | Access |
|---|---|---|
interval | Duration | 🔒 private |
next | Instant | 🔒 private |
active | bool | 🔒 private |
Methods:
| Method | Signature | Description |
|---|---|---|
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.vxL7-10
export struct InstantImplements: Clone & Copy & Eq & Ord
Fields:
| Name | Type | Access |
|---|---|---|
ticks | u64 | 🔒 private |
Methods:
| Method | Signature | Description |
|---|---|---|
Instant.now↗ | export fn Instant.now(): Instant | |
clone↗ | export fn (self: &Instant) clone(): Instant | |
asNanos↗ | export fn (self: &Instant) asNanos(): u64 | Process-local clock reading for diagnostics and native interop. It has no |
durationSince↗ | export fn (self: &Instant) durationSince(earlier: Instant): Duration | Signed difference with saturation at Duration's representable limits. |
saturatingDurationSince↗ | export fn (self: &Instant) saturatingDurationSince(earlier: Instant): Duration | Non-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.vxL17-27
export struct LocationImplements: Display & Clone
Fields:
| Name | Type | Access |
|---|---|---|
name | string | 🔒 private |
offsetSeconds | i64 | 🔒 private |
isDynamic | i32 | 🔒 private |
Methods:
| Method | Signature | Description |
|---|---|---|
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(): i64 | Standard (base) offset in seconds. |
offsetAtUnix↗ | export fn (self: &Location) offsetAtUnix(unixSec: i64): i64 | Actual UTC offset at an arbitrary Unix timestamp. |
offsetAt↗ | export fn (self: &Location) offsetAt(t: Time): i64 | Offset at a Time instant. |
offsetHours↗ | export fn (self: &Location) offsetHours(): i32 | Offset in whole hours. |
clone↗ | export fn (self: &Location) clone(): Location | Clone. |
toString↗ | export fn (self: &Location) toString(): string | Display: "America/New_York (UTC-5)" |
tm
📄
native.linux.vxcL9-22
struct tmFields:
| Name | Type | Access |
|---|---|---|
tm_sec | i32 | 🔓 public |
tm_min | i32 | 🔓 public |
tm_hour | i32 | 🔓 public |
tm_mday | i32 | 🔓 public |
tm_mon | i32 | 🔓 public |
tm_year | i32 | 🔓 public |
tm_wday | i32 | 🔓 public |
tm_yday | i32 | 🔓 public |
tm_isdst | i32 | 🔓 public |
tm_gmtoff | i64 | 🔓 public |
tm_zone | Ptr<u8> | 🔓 public |
tm
📄
native.macos.vxcL9-22
struct tmFields:
| Name | Type | Access |
|---|---|---|
tm_sec | i32 | 🔓 public |
tm_min | i32 | 🔓 public |
tm_hour | i32 | 🔓 public |
tm_mday | i32 | 🔓 public |
tm_mon | i32 | 🔓 public |
tm_year | i32 | 🔓 public |
tm_wday | i32 | 🔓 public |
tm_yday | i32 | 🔓 public |
tm_isdst | i32 | 🔓 public |
tm_gmtoff | i64 | 🔓 public |
tm_zone | Ptr<u8> | 🔓 public |
SYSTEMTIME
📄
native.windows.vxcL4-13
struct SYSTEMTIMEFields:
| Name | Type | Access |
|---|---|---|
wYear | u16 | 🔒 private |
wMonth | u16 | 🔒 private |
wDayOfWeek | u16 | 🔒 private |
wDay | u16 | 🔒 private |
wHour | u16 | 🔒 private |
wMinute | u16 | 🔒 private |
wSecond | u16 | 🔒 private |
wMilliseconds | u16 | 🔒 private |
TIME_ZONE_INFORMATION
📄
native.windows.vxcL15-24
struct TIME_ZONE_INFORMATIONFields:
| Name | Type | Access |
|---|---|---|
Bias | i32 | 🔓 public |
StandardName | [u16; 32] | 🔓 public |
StandardDate | SYSTEMTIME | 🔓 public |
StandardBias | i32 | 🔓 public |
DaylightName | [u16; 32] | 🔓 public |
DaylightDate | SYSTEMTIME | 🔓 public |
DaylightBias | i32 | 🔓 public |
ScanResult
📄
parse.vxL6-10
struct ScanResultFields:
| Name | Type | Access |
|---|---|---|
value | i32 | 🔓 public |
count | i32 | 🔓 public |
ScanResult64
📄
parse.vxL11-15
struct ScanResult64Fields:
| Name | Type | Access |
|---|---|---|
value | i64 | 🔓 public |
count | i32 | 🔓 public |
DateTimeParts 🔓 export
📄
time_type.vxL28-37
export struct DateTimePartsFields:
| Name | Type | Access |
|---|---|---|
y | i32 | 🔒 readonly |
mo | i32 | 🔒 readonly |
d | i32 | 🔒 readonly |
h | i32 | 🔒 readonly |
min | i32 | 🔒 readonly |
s | i32 | 🔒 readonly |
wd | i32 | 🔒 readonly |
Methods:
| Method | Signature | Description |
|---|---|---|
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.vxL78-81
export struct TimeImplements: Display & Clone & Copy & Eq & Ord
Fields:
| Name | Type | Access |
|---|---|---|
ns | i64 | 🔒 readonly |
Methods:
| Method | Signature | Description |
|---|---|---|
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): Time | Constructs 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(): i64 | Total nanoseconds elapsed since the Unix epoch. |
unixMilli↗ | export fn (self: &Time) unixMilli(): i64 | Total milliseconds elapsed since the Unix epoch, rounded toward the past. |
unixMicro↗ | export fn (self: &Time) unixMicro(): i64 | Total microseconds elapsed since the Unix epoch, rounded toward the past. |
nanosecond↗ | export fn (self: &Time) nanosecond(): i64 | Nanosecond 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.vxL5-18
export enum MonthVariants:
JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Weekday 🔓 export
📄
constants.vxL20-28
export enum WeekdayVariants:
SundayMondayTuesdayWednesdayThursdayFridaySaturday
Functions
abs_date 🔓 export
📄
conversions.vxL15-30
export fn abs_date(abs_sec: i64): DatePartsParameters:
| Name | Type |
|---|---|
abs_sec | i64 |
Returns: DateParts
is_leap 🔓 export
📄
conversions.vxL32-34
export fn is_leap(year: i32): boolParameters:
| Name | Type |
|---|---|
year | i32 |
Returns: bool
nsToDateTime 🔓 export
📄
conversions.vxL37-58
export fn nsToDateTime(ns: i64): (i32, i32, i32, i32, i32, i32, i32)Parameters:
| Name | Type |
|---|---|
ns | i64 |
Returns: (i32, i32, i32, i32, i32, i32, i32)
magnitude
📄
duration.vxL10-16
fn magnitude(value: i64): u64Parameters:
| Name | Type |
|---|---|
value | i64 |
Returns: u64
seconds 🔓 export
📄
duration.vxL47-49
export fn seconds(s: i64): DurationParameters:
| Name | Type |
|---|---|
s | i64 |
Returns: Duration
milliseconds 🔓 export
📄
duration.vxL51-53
export fn milliseconds(ms: i64): DurationParameters:
| Name | Type |
|---|---|
ms | i64 |
Returns: Duration
microseconds 🔓 export
📄
duration.vxL55-57
export fn microseconds(us: i64): DurationParameters:
| Name | Type |
|---|---|
us | i64 |
Returns: Duration
nanoseconds 🔓 export
📄
duration.vxL59-61
export fn nanoseconds(ns: i64): DurationParameters:
| Name | Type |
|---|---|
ns | i64 |
Returns: Duration
minutes 🔓 export
📄
duration.vxL63-65
export fn minutes(m: i64): DurationParameters:
| Name | Type |
|---|---|
m | i64 |
Returns: Duration
hours 🔓 export
📄
duration.vxL67-69
export fn hours(h: i64): DurationParameters:
| Name | Type |
|---|---|
h | i64 |
Returns: Duration
fmt_int
📄
format.vxcL5-25
fn fmt_int(val: i32, width: i32): stringPad integer with zeros to width
Parameters:
| Name | Type |
|---|---|
val | i32 |
width | i32 |
Returns: string
format_layout 🔓 export
📄
format.vxcL29-107
export fn format_layout(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32, ns: i64, layout: string): stringToken-based formatting (Day.js style)
Supported tokens: YYYY, MM, DD, HH, mm, ss, SSS, Z
Parameters:
| Name | Type |
|---|---|
y | i32 |
m | i32 |
d | i32 |
h | i32 |
min | i32 |
s | i32 |
ns | i64 |
layout | string |
Returns: string
now 🔓 export
📄
helpers.vxL13-15
export fn now(): TimeReturns: Time
sleep 🔓 export
📄
helpers.vxL18-22
export fn sleep(d: i64)Parameters:
| Name | Type |
|---|---|
d | i64 |
sleep 🔓 export
📄
helpers.vxL25-30
export fn sleep(d: Duration)Parameters:
| Name | Type |
|---|---|
d | Duration |
getLocalOffset 🔓 export
📄
helpers.vxL33-35
export fn getLocalOffset(): i64Returns: i64
since 🔓 export
📄
helpers.vxL45-48
export fn since(t: Time): DurationParameters:
| Name | Type |
|---|---|
t | Time |
Returns: Duration
until 🔓 export
📄
helpers.vxL51-54
export fn until(t: Time): DurationParameters:
| Name | Type |
|---|---|
t | Time |
Returns: Duration
truncate 🔓 export
📄
helpers.vxL57-63
export fn truncate(t: Time, d: Duration): TimeParameters:
| Name | Type |
|---|---|
t | Time |
d | Duration |
Returns: Time
round 🔓 export
📄
helpers.vxL66-75
export fn round(t: Time, d: Duration): TimeParameters:
| Name | Type |
|---|---|
t | Time |
d | Duration |
Returns: Time
unix 🔓 export
📄
helpers.vxL78-80
export fn unix(sec: i64, nsec: i64): TimeParameters:
| Name | Type |
|---|---|
sec | i64 |
nsec | i64 |
Returns: Time
unix_seconds 🔓 export
📄
helpers.vxL83-83
export fn unix_seconds(t: Time): i64Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: i64
unix_nanosecond 🔓 export
📄
helpers.vxL84-84
export fn unix_nanosecond(t: Time): i64Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: i64
unix_milli 🔓 export
📄
helpers.vxL85-85
export fn unix_milli(t: Time): i64Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: i64
unix_micro 🔓 export
📄
helpers.vxL86-86
export fn unix_micro(t: Time): i64Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: i64
compare 🔓 export
📄
helpers.vxL89-91
export fn compare(t1: Time, t2: Time): i32Parameters:
| Name | Type |
|---|---|
t1 | Time |
t2 | Time |
Returns: i32
before 🔓 export
📄
helpers.vxL93-93
export fn before(t1: Time, t2: Time): boolParameters:
| Name | Type |
|---|---|
t1 | Time |
t2 | Time |
Returns: bool
after 🔓 export
📄
helpers.vxL94-94
export fn after(t1: Time, t2: Time): boolParameters:
| Name | Type |
|---|---|
t1 | Time |
t2 | Time |
Returns: bool
equal 🔓 export
📄
helpers.vxL95-95
export fn equal(t1: Time, t2: Time): boolParameters:
| Name | Type |
|---|---|
t1 | Time |
t2 | Time |
Returns: bool
after 🔓 export
📄
helpers.vxL98-105
export fn after(d: Duration): Channel<Time>Parameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Channel<Time>
weekday 🔓 export
📄
helpers.vxL108-108
export fn weekday(t: Time): WeekdayParameters:
| Name | Type |
|---|---|
t | Time |
Returns: Weekday
date 🔓 export
📄
helpers.vxL110-112
export fn date(t: Time): (i32, Month, i32)Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: (i32, Month, i32)
clock 🔓 export
📄
helpers.vxL114-116
export fn clock(t: Time): (i32, i32, i32)Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: (i32, i32, i32)
newTimer 🔓 export
📄
helpers.vxL139-141
export fn newTimer(d: Duration): TimerParameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Timer
newTicker 🔓 export
📄
helpers.vxL212-214
export fn newTicker(d: Duration): TickerParameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Ticker
afterDuration 🔓 export
📄
helpers.vxL252-255
export fn afterDuration(d: Duration): TimeParameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Time
tz_pad2
📄
helpers.vxL261-264
fn tz_pad2(n: i64): stringParameters:
| Name | Type |
|---|---|
n | i64 |
Returns: string
tz_pad4
📄
helpers.vxL266-271
fn tz_pad4(n: i64): stringParameters:
| Name | Type |
|---|---|
n | i64 |
Returns: string
formatInLocation 🔓 export
📄
helpers.vxL275-278
export fn formatInLocation(t: Time, layout: str, loc: &Location): stringParameters:
| Name | Type |
|---|---|
t | Time |
layout | str |
loc | &Location |
Returns: string
toRFC3339InLocation 🔓 export
📄
helpers.vxL281-306
export fn toRFC3339InLocation(t: Time, loc: &Location): stringParameters:
| Name | Type |
|---|---|
t | Time |
loc | &Location |
Returns: string
inLocation 🔓 export
📄
helpers.vxL310-313
export fn inLocation(t: Time, loc: &Location): TimeParameters:
| Name | Type |
|---|---|
t | Time |
loc | &Location |
Returns: Time
isDST 🔓 export
📄
helpers.vxL316-318
export fn isDST(t: Time, loc: &Location): boolParameters:
| Name | Type |
|---|---|
t | Time |
loc | &Location |
Returns: bool
signedDurationBetween
📄
instant.vxL12-27
fn signedDurationBetween(later: u64, earlier: u64): DurationParameters:
| Name | Type |
|---|---|
later | u64 |
earlier | u64 |
Returns: Duration
utc 🔓 export
📄
lib.vxL5-5
export fn utc(): LocationReturns: Location
local 🔓 export
📄
lib.vxL6-6
export fn local(): LocationReturns: Location
fixed_zone 🔓 export
📄
lib.vxL7-7
export fn fixed_zone(name: string, offset: i32): LocationParameters:
| Name | Type |
|---|---|
name | string |
offset | i32 |
Returns: Location
load_location 🔓 export
📄
lib.vxL8-8
export fn load_location(name: string): Result<Location, string>Parameters:
| Name | Type |
|---|---|
name | string |
Returns: Result<Location, string>
UTC 🔓 export
📄
location.vxL70-72
export fn UTC(): LocationReturns: Location
Local 🔓 export
📄
location.vxL74-77
export fn Local(): LocationReturns: Location
fixedZone 🔓 export
📄
location.vxL79-81
export fn fixedZone(name: string, offsetSeconds: i64): LocationParameters:
| Name | Type |
|---|---|
name | string |
offsetSeconds | i64 |
Returns: Location
loadLocation 🔓 export
📄
location.vxL90-110
export fn loadLocation(name: string): Result<Location, string>Parameters:
| Name | Type |
|---|---|
name | string |
Returns: Result<Location, string>
EST 🔓 export
📄
location.vxL173-173
export fn EST(): LocationReturns: Location
PST 🔓 export
📄
location.vxL174-174
export fn PST(): LocationReturns: Location
CET 🔓 export
📄
location.vxL175-175
export fn CET(): LocationReturns: Location
TRT 🔓 export
📄
location.vxL176-176
export fn TRT(): LocationReturns: Location
JST 🔓 export
📄
location.vxL177-177
export fn JST(): LocationReturns: Location
vex_tz_offset_at_shim 🔓 export
📄
native.linux.vxcL29-31
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64
vex_tz_exists_shim 🔓 export
📄
native.linux.vxcL33-35
export fn vex_tz_exists_shim(name: Ptr<u8>): i32Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32
vex_get_local_offset 🔓 export
📄
native.linux.vxcL37-47
export fn vex_get_local_offset(): i64Returns: i64
vex_tz_offset_at_shim 🔓 export
📄
native.macos.vxcL29-31
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64
vex_tz_exists_shim 🔓 export
📄
native.macos.vxcL33-35
export fn vex_tz_exists_shim(name: Ptr<u8>): i32Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32
vex_get_local_offset 🔓 export
📄
native.macos.vxcL37-47
export fn vex_get_local_offset(): i64Returns: i64
unsupportedTimeProvider
📄
native.vxcL12-14
fn unsupportedTimeProvider(): NoneReturns: None
vex_time_current_ns 🔓 export
📄
native.vxcL16-18
export fn vex_time_current_ns(): u64Returns: u64
vex_monotonic_ns 🔓 export
📄
native.vxcL20-22
export fn vex_monotonic_ns(): u64Returns: u64
vex_nanosleep 🔓 export
📄
native.vxcL24-26
export fn vex_nanosleep(_ns: i64)Parameters:
| Name | Type |
|---|---|
_ns | i64 |
vex_get_local_offset 🔓 export
📄
native.vxcL28-30
export fn vex_get_local_offset(): i64Returns: i64
vex_tz_offset_at_shim 🔓 export
📄
native.vxcL32-34
export fn vex_tz_offset_at_shim(_name: Ptr<u8>, _unixSec: i64): i64Parameters:
| Name | Type |
|---|---|
_name | Ptr<u8> |
_unixSec | i64 |
Returns: i64
vex_tz_exists_shim 🔓 export
📄
native.vxcL36-38
export fn vex_tz_exists_shim(_name: Ptr<u8>): i32Parameters:
| Name | Type |
|---|---|
_name | Ptr<u8> |
Returns: i32
vex_tz_offset_at_shim 🔓 export
📄
native.windows.vxcL35-37
export fn vex_tz_offset_at_shim(name: Ptr<u8>, unix_sec: i64): i64Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64
vex_tz_exists_shim 🔓 export
📄
native.windows.vxcL39-41
export fn vex_tz_exists_shim(name: Ptr<u8>): i32Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32
vex_get_local_offset 🔓 export
📄
native.windows.vxcL43-77
export fn vex_get_local_offset(): i64Returns: i64
isDigit
📄
parse.vxL17-19
fn isDigit(c: u8): boolParameters:
| Name | Type |
|---|---|
c | u8 |
Returns: bool
scan_int_at
📄
parse.vxL21-35
fn scan_int_at(s: str, pos: usize, digits: i32): ScanResultParameters:
| Name | Type |
|---|---|
s | str |
pos | usize |
digits | i32 |
Returns: ScanResult
scanRfc2
📄
parse.vxL40-47
fn scanRfc2(s: str, pos: usize): i32Parameters:
| Name | Type |
|---|---|
s | str |
pos | usize |
Returns: i32
scanRfc4
📄
parse.vxL49-61
fn scanRfc4(s: str, pos: usize): i32Parameters:
| Name | Type |
|---|---|
s | str |
pos | usize |
Returns: i32
scan_nanos_at
📄
parse.vxL63-77
fn scan_nanos_at(s: str, pos: usize): ScanResult64Parameters:
| Name | Type |
|---|---|
s | str |
pos | usize |
Returns: ScanResult64
daysFromCivil
📄
parse.vxL83-93
fn daysFromCivil(year: i32, month: i32, day: i32): i64Parameters:
| Name | Type |
|---|---|
year | i32 |
month | i32 |
day | i32 |
Returns: i64
validDateTime
📄
parse.vxL95-102
fn validDateTime(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32): boolParameters:
| Name | Type |
|---|---|
y | i32 |
m | i32 |
d | i32 |
h | i32 |
min | i32 |
s | i32 |
Returns: bool
partsToNs
📄
parse.vxL104-128
fn partsToNs(y: i32, m: i32, d: i32, h: i32, min: i32, s: i32, ns: i64, offsetSeconds: i32): Option<i64>Parameters:
| Name | Type |
|---|---|
y | i32 |
m | i32 |
d | i32 |
h | i32 |
min | i32 |
s | i32 |
ns | i64 |
offsetSeconds | i32 |
Returns: Option<i64>
parse 🔓 export
📄
parse.vxL130-183
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:
| Name | Type | Description |
|---|---|---|
layout | str | Explicit YYYY/MM/DD/HH/mm/ss token layout with literal separators |
input | str | Date/time text to match completely |
Returns: Result<Time, string>
parse_rfc3339 🔓 export
📄
parse.vxL185-241
export fn parse_rfc3339(input: str): Result<Time, string>Parameters:
| Name | Type |
|---|---|
input | str |
Returns: Result<Time, string>
parse_duration 🔓 export
📄
parse.vxL243-326
export fn parse_duration(input: str): Result<Duration, string>Parameters:
| Name | Type |
|---|---|
input | str |
Returns: Result<Duration, string>
days_in_month 🔓 export
📄
time_type.vxL14-22
export fn days_in_month(m: i32, year: i32): i32Parameters:
| Name | Type |
|---|---|
m | i32 |
year | i32 |
Returns: i32
ns_to_datetime 🔓 export
📄
time_type.vxL47-72
export fn ns_to_datetime(ns: i64): DateTimePartsParameters:
| Name | Type |
|---|---|
ns | i64 |
Returns: DateTimeParts
floor_div
📄
time_type.vxL110-117
fn floor_div(value: i64, unit: i64): i64Parameters:
| Name | Type |
|---|---|
value | i64 |
unit | i64 |
Returns: i64
add 🔓 export
📄
time_type.vxL246-248
export fn add(t: Time, d: Duration): TimeParameters:
| Name | Type |
|---|---|
t | Time |
d | Duration |
Returns: Time
sub 🔓 export
📄
time_type.vxL250-252
export fn sub(t1: Time, t2: Time): DurationParameters:
| Name | Type |
|---|---|
t1 | Time |
t2 | Time |
Returns: Duration
write_padded_int
📄
time_type.vxL344-356
fn write_padded_int(sb: &StringBuilder!, val: i64, width: i32)Parameters:
| Name | Type |
|---|---|
sb | &StringBuilder! |
val | i64 |
width | i32 |
expect
📄
basic.test.vxL11-14
fn expect(cond: bool, code: i32): i32Parameters:
| Name | Type |
|---|---|
cond | bool |
code | i32 |
Returns: i32
test_monotonic
📄
basic.test.vxL16-20
fn test_monotonic(): i32Returns: i32
test_now_since_until_and_add
📄
basic.test.vxL22-29
fn test_now_since_until_and_add(): i32Returns: i32
test_parse_duration
📄
basic.test.vxL31-42
fn test_parse_duration(): i32Returns: i32
test_rfc3339_parse_components
📄
basic.test.vxL44-55
fn test_rfc3339_parse_components(): i32Returns: i32
test_unix_helpers
📄
basic.test.vxL57-65
fn test_unix_helpers(): i32Returns: i32
test_rfc3339_millisecond_writer
📄
basic.test.vxL67-73
fn test_rfc3339_millisecond_writer(): i32Returns: i32
test_time_checked_and_saturating_boundaries
📄
basic.test.vxL75-98
fn test_time_checked_and_saturating_boundaries(): i32Returns: i32
test_compare_and_order
📄
basic.test.vxL100-108
fn test_compare_and_order(): i32Returns: i32
test_truncate_and_round
📄
basic.test.vxL110-116
fn test_truncate_and_round(): i32Returns: i32
test_after_channel
📄
basic.test.vxL118-128
fn test_after_channel(): i32Returns: i32
test_duration_overflow_policies
📄
basic.test.vxL130-149
fn test_duration_overflow_policies(): i32Returns: i32
test_instant_is_typed_and_monotonic
📄
basic.test.vxL151-159
fn test_instant_is_typed_and_monotonic(): i32Returns: i32
test_rfc3339_offsets_and_fraction
📄
basic.test.vxL161-179
fn test_rfc3339_offsets_and_fraction(): i32Returns: i32
test_rfc3339_validation_and_i64_boundaries
📄
basic.test.vxL181-211
fn test_rfc3339_validation_and_i64_boundaries(): i32Returns: i32
test_duration_fraction_sign_units_and_boundaries
📄
basic.test.vxL213-250
fn test_duration_fraction_sign_units_and_boundaries(): i32Returns: i32
bench_instant_now
📄
bench.test.vxL5-7
fn bench_instant_now(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_time_now
📄
bench.test.vxL9-11
fn bench_time_now(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_time_checked_add
📄
bench.test.vxL13-19
fn bench_time_checked_add(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_duration_checked_arithmetic
📄
bench.test.vxL21-27
fn bench_duration_checked_arithmetic(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_parse_rfc3339_utc
📄
bench.test.vxL29-32
fn bench_parse_rfc3339_utc(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_parse_rfc3339_offset
📄
bench.test.vxL34-37
fn bench_parse_rfc3339_offset(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_parse_duration_compound
📄
bench.test.vxL39-42
fn bench_parse_duration_compound(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_duration_to_string
📄
bench.test.vxL44-47
fn bench_duration_to_string(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
bench_time_to_string
📄
bench.test.vxL49-52
fn bench_time_to_string(b: &BenchCtx!)Parameters:
| Name | Type |
|---|---|
b | &BenchCtx! |
test_now_and_monotonic
📄
comprehensive.test.vxL5-11
fn test_now_and_monotonic(): i32Returns: i32
test_unix_construction
📄
comprehensive.test.vxL13-29
fn test_unix_construction(): i32Returns: i32
test_parse_duration_basic
📄
comprehensive.test.vxL31-46
fn test_parse_duration_basic(): i32Returns: i32
test_duration_constants
📄
comprehensive.test.vxL48-57
fn test_duration_constants(): i32Returns: i32
test_arithmetic
📄
comprehensive.test.vxL59-70
fn test_arithmetic(): i32Returns: i32
test_since_until
📄
comprehensive.test.vxL72-81
fn test_since_until(): i32Returns: i32
test_rfc3339_parse
📄
comprehensive.test.vxL83-96
fn test_rfc3339_parse(): i32Returns: i32
test_zones
📄
comprehensive.test.vxL98-107
fn test_zones(): i32Returns: i32
test_date_components
📄
comprehensive.test.vxL109-116
fn test_date_components(): i32Returns: i32
test_clock_components
📄
comprehensive.test.vxL118-125
fn test_clock_components(): i32Returns: i32
test_weekday_yearday
📄
comprehensive.test.vxL127-133
fn test_weekday_yearday(): i32Returns: i32
test_comparisons
📄
comprehensive.test.vxL135-146
fn test_comparisons(): i32Returns: i32
test_truncate_round
📄
comprehensive.test.vxL148-158
fn test_truncate_round(): i32Returns: i32
test_unix_helpers
📄
comprehensive.test.vxL160-168
fn test_unix_helpers(): i32Returns: i32
test_start_end_of_boundaries
📄
comprehensive.test.vxL170-221
fn test_start_end_of_boundaries(): i32Returns: i32
test_timer_ticker_phase2
📄
comprehensive.test.vxL223-256
fn test_timer_ticker_phase2(): i32Returns: i32
test_after_channel_api
📄
comprehensive.test.vxL258-268
fn test_after_channel_api(): i32Returns: i32
test_load_location_dst_rules
📄
comprehensive.test.vxL270-314
fn test_load_location_dst_rules(): i32Returns: i32
test_dst_transition_instants
📄
comprehensive.test.vxL316-393
fn test_dst_transition_instants(): i32Returns: i32
test_location_clone_preserves_heap_backed_name
📄
ownership.test.vxL3-14
fn test_location_clone_preserves_heap_backed_name()test_duration_tostring
📄
phase3.test.vxL10-39
fn test_duration_tostring(): i32Returns: i32
test_duration_neg_cmp
📄
phase3.test.vxL45-62
fn test_duration_neg_cmp(): i32Returns: i32
test_add_date
📄
phase3.test.vxL68-115
fn test_add_date(): i32Returns: i32
test_in_location
📄
phase3.test.vxL121-156
fn test_in_location(): i32Returns: i32
test_rfc3339_with_offset
📄
phase3.test.vxL162-206
fn test_rfc3339_with_offset(): i32Returns: i32
test_is_dst
📄
phase3.test.vxL212-248
fn test_is_dst(): i32Returns: i32
test_extra_timezone_aliases
📄
phase3.test.vxL254-339
fn test_extra_timezone_aliases(): i32Returns: i32
test_au_sydney_dst
📄
phase3.test.vxL345-381
fn test_au_sydney_dst(): i32Returns: i32
test_time_format
📄
phase3.test.vxL387-404
fn test_time_format(): i32Returns: i32
main 🔓 export
📄
unit_test.vxL3-35
export fn main(): i32Returns: i32
Methods
Duration.seconds 🔓 export
📄
duration.vxL22-24
export fn Duration.seconds(s: i64): DurationUsage contract: Scales to signed i64 nanoseconds using checked multiplication and panics on overflow. Duration is elapsed time, not a timezone-aware calendar interval.
Parameters:
| Name | Type | Description |
|---|---|---|
s | i64 | Signed duration count in seconds |
Returns: Duration
Duration.milliseconds 🔓 export
📄
duration.vxL26-28
export fn Duration.milliseconds(ms: i64): DurationParameters:
| Name | Type |
|---|---|
ms | i64 |
Returns: Duration
Duration.microseconds 🔓 export
📄
duration.vxL30-32
export fn Duration.microseconds(us: i64): DurationParameters:
| Name | Type |
|---|---|
us | i64 |
Returns: Duration
Duration.nanoseconds 🔓 export
📄
duration.vxL34-36
export fn Duration.nanoseconds(ns: i64): DurationParameters:
| Name | Type |
|---|---|
ns | i64 |
Returns: Duration
Duration.minutes 🔓 export
📄
duration.vxL38-40
export fn Duration.minutes(m: i64): DurationParameters:
| Name | Type |
|---|---|
m | i64 |
Returns: Duration
Duration.hours 🔓 export
📄
duration.vxL42-44
export fn Duration.hours(h: i64): DurationParameters:
| Name | Type |
|---|---|
h | i64 |
Returns: Duration
asSeconds 🔓 export
📄
duration.vxL75-77
export fn (self: &Duration) asSeconds(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
asMillis 🔓 export
📄
duration.vxL79-81
export fn (self: &Duration) asMillis(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
asMicros 🔓 export
📄
duration.vxL83-85
export fn (self: &Duration) asMicros(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
asNanos 🔓 export
📄
duration.vxL87-89
export fn (self: &Duration) asNanos(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
asMinutes 🔓 export
📄
duration.vxL91-93
export fn (self: &Duration) asMinutes(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
asHours 🔓 export
📄
duration.vxL95-97
export fn (self: &Duration) asHours(): i64Receiver: self: &Duration (immutable reference)
Returns: i64
add 🔓 export
📄
duration.vxL103-108
export fn (self: &Duration) add(other: Duration): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Duration
sub 🔓 export
📄
duration.vxL110-115
export fn (self: &Duration) sub(other: Duration): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Duration
mul 🔓 export
📄
duration.vxL117-122
export fn (self: &Duration) mul(n: i64): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
n | i64 |
Returns: Duration
div 🔓 export
📄
duration.vxL124-129
export fn (self: &Duration) div(n: i64): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
n | i64 |
Returns: Duration
checkedAdd 🔓 export
📄
duration.vxL131-137
export fn (self: &Duration) checkedAdd(other: Duration): Option<Duration>Receiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Option<Duration>
checkedSub 🔓 export
📄
duration.vxL139-145
export fn (self: &Duration) checkedSub(other: Duration): Option<Duration>Receiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Option<Duration>
checkedMul 🔓 export
📄
duration.vxL147-160
export fn (self: &Duration) checkedMul(n: i64): Option<Duration>Receiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
n | i64 |
Returns: Option<Duration>
checkedDiv 🔓 export
📄
duration.vxL162-166
export fn (self: &Duration) checkedDiv(n: i64): Option<Duration>Receiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
n | i64 |
Returns: Option<Duration>
saturatingAdd 🔓 export
📄
duration.vxL168-176
export fn (self: &Duration) saturatingAdd(other: Duration): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Duration
saturatingSub 🔓 export
📄
duration.vxL178-186
export fn (self: &Duration) saturatingSub(other: Duration): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | Duration |
Returns: Duration
saturatingMul 🔓 export
📄
duration.vxL188-198
export fn (self: &Duration) saturatingMul(n: i64): DurationReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
n | i64 |
Returns: Duration
isZero 🔓 export
📄
duration.vxL204-206
export fn (self: &Duration) isZero(): boolReceiver: self: &Duration (immutable reference)
Returns: bool
isNegative 🔓 export
📄
duration.vxL208-210
export fn (self: &Duration) isNegative(): boolReceiver: self: &Duration (immutable reference)
Returns: bool
abs 🔓 export
📄
duration.vxL212-216
export fn (self: &Duration) abs(): DurationReceiver: self: &Duration (immutable reference)
Returns: Duration
saturatingAbs 🔓 export
📄
duration.vxL218-223
export fn (self: &Duration) saturatingAbs(): DurationReceiver: self: &Duration (immutable reference)
Returns: Duration
clone 🔓 export
📄
duration.vxL229-231
export fn (self: &Duration) clone(): DurationReceiver: self: &Duration (immutable reference)
Returns: Duration
neg 🔓 export
📄
duration.vxL233-236
export fn (self: &Duration) neg(): DurationReceiver: self: &Duration (immutable reference)
Returns: Duration
cmp 🔓 export
📄
duration.vxL238-242
export fn (self: &Duration) cmp(other: &Duration): i32Receiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: i32
op== 🔓 export
📄
duration.vxL244-244
export fn (self: &Duration) op==(other: &Duration): boolReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: bool
op< 🔓 export
📄
duration.vxL245-245
export fn (self: &Duration) op<(other: &Duration): boolReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: bool
op> 🔓 export
📄
duration.vxL246-246
export fn (self: &Duration) op>(other: &Duration): boolReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: bool
op<= 🔓 export
📄
duration.vxL247-247
export fn (self: &Duration) op<=(other: &Duration): boolReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: bool
op>= 🔓 export
📄
duration.vxL248-248
export fn (self: &Duration) op>=(other: &Duration): boolReceiver: self: &Duration (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Duration |
Returns: bool
toString 🔓 export
📄
duration.vxL251-275
export fn (self: &Duration) toString(): stringReceiver: self: &Duration (immutable reference)
Returns: string
Timer.new 🔓 export
📄
helpers.vxL129-137
export fn Timer.new(d: Duration): TimerParameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Timer
expired 🔓 export
📄
helpers.vxL143-151
export fn (self: &Timer) expired(): boolReceiver: self: &Timer (immutable reference)
Returns: bool
poll 🔓 export
📄
helpers.vxL153-166
export fn (self: &Timer!) poll(): boolReceiver: self: &Timer! (mutable reference)
Returns: bool
reset 🔓 export
📄
helpers.vxL168-173
export fn (self: &Timer!) reset(d: Duration)Receiver: self: &Timer! (mutable reference)
Parameters:
| Name | Type |
|---|---|
d | Duration |
stop 🔓 export
📄
helpers.vxL175-177
export fn (self: &Timer!) stop()Receiver: self: &Timer! (mutable reference)
wait 🔓 export
📄
helpers.vxL179-193
export fn (self: &Timer!) wait(): TimeReceiver: self: &Timer! (mutable reference)
Returns: Time
Ticker.new 🔓 export
📄
helpers.vxL202-210
export fn Ticker.new(d: Duration): TickerParameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Ticker
tick 🔓 export
📄
helpers.vxL216-237
export fn (self: &Ticker!) tick(): boolReceiver: self: &Ticker! (mutable reference)
Returns: bool
reset 🔓 export
📄
helpers.vxL239-245
export fn (self: &Ticker!) reset(d: Duration)Receiver: self: &Ticker! (mutable reference)
Parameters:
| Name | Type |
|---|---|
d | Duration |
stop 🔓 export
📄
helpers.vxL247-249
export fn (self: &Ticker!) stop()Receiver: self: &Ticker! (mutable reference)
Instant.now 🔓 export
📄
instant.vxL29-31
export fn Instant.now(): InstantReturns: Instant
clone 🔓 export
📄
instant.vxL33-35
export fn (self: &Instant) clone(): InstantReceiver: self: &Instant (immutable reference)
Returns: Instant
asNanos 🔓 export
📄
instant.vxL39-41
export fn (self: &Instant) asNanos(): u64Process-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.vxL44-46
export fn (self: &Instant) durationSince(earlier: Instant): DurationSigned difference with saturation at Duration's representable limits.
Receiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
earlier | Instant |
Returns: Duration
saturatingDurationSince 🔓 export
📄
instant.vxL49-52
export fn (self: &Instant) saturatingDurationSince(earlier: Instant): DurationNon-negative difference; clock anomalies or reversed operands yield zero.
Receiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
earlier | Instant |
Returns: Duration
elapsed 🔓 export
📄
instant.vxL54-56
export fn (self: &Instant) elapsed(): DurationReceiver: self: &Instant (immutable reference)
Returns: Duration
checkedAdd 🔓 export
📄
instant.vxL58-73
export fn (self: &Instant) checkedAdd(duration: Duration): Option<Instant>Receiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
duration | Duration |
Returns: Option<Instant>
checkedSub 🔓 export
📄
instant.vxL75-90
export fn (self: &Instant) checkedSub(duration: Duration): Option<Instant>Receiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
duration | Duration |
Returns: Option<Instant>
saturatingAdd 🔓 export
📄
instant.vxL92-100
export fn (self: &Instant) saturatingAdd(duration: Duration): InstantReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
duration | Duration |
Returns: Instant
saturatingSub 🔓 export
📄
instant.vxL102-110
export fn (self: &Instant) saturatingSub(duration: Duration): InstantReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
duration | Duration |
Returns: Instant
op== 🔓 export
📄
instant.vxL112-112
export fn (self: &Instant) op==(other: &Instant): boolReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Instant |
Returns: bool
op< 🔓 export
📄
instant.vxL113-113
export fn (self: &Instant) op<(other: &Instant): boolReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Instant |
Returns: bool
op> 🔓 export
📄
instant.vxL114-114
export fn (self: &Instant) op>(other: &Instant): boolReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Instant |
Returns: bool
op<= 🔓 export
📄
instant.vxL115-115
export fn (self: &Instant) op<=(other: &Instant): boolReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Instant |
Returns: bool
op>= 🔓 export
📄
instant.vxL116-116
export fn (self: &Instant) op>=(other: &Instant): boolReceiver: self: &Instant (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Instant |
Returns: bool
Location.utc 🔓 export
📄
location.vxL34-36
export fn Location.utc(): LocationReturns: Location
Location.local 🔓 export
📄
location.vxL38-41
export fn Location.local(): LocationReturns: Location
Location.fixedZone 🔓 export
📄
location.vxL43-45
export fn Location.fixedZone(name: string, offsetSeconds: i64): LocationParameters:
| Name | Type |
|---|---|
name | string |
offsetSeconds | i64 |
Returns: Location
Location.load 🔓 export
📄
location.vxL47-67
export fn Location.load(name: string): Result<Location, string>Parameters:
| Name | Type |
|---|---|
name | string |
Returns: Result<Location, string>
offset 🔓 export
📄
location.vxL117-119
export fn (self: &Location) offset(): i64Standard (base) offset in seconds.
Receiver: self: &Location (immutable reference)
Returns: i64
offsetAtUnix 🔓 export
📄
location.vxL124-131
export fn (self: &Location) offsetAtUnix(unixSec: i64): i64Actual 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:
| Name | Type |
|---|---|
unixSec | i64 |
Returns: i64
offsetAt 🔓 export
📄
location.vxL134-136
export fn (self: &Location) offsetAt(t: Time): i64Offset at a Time instant.
Receiver: self: &Location (immutable reference)
Parameters:
| Name | Type |
|---|---|
t | Time |
Returns: i64
offsetHours 🔓 export
📄
location.vxL139-141
export fn (self: &Location) offsetHours(): i32Offset in whole hours.
Receiver: self: &Location (immutable reference)
Returns: i32
clone 🔓 export
📄
location.vxL144-150
export fn (self: &Location) clone(): LocationClone.
Receiver: self: &Location (immutable reference)
Returns: Location
toString 🔓 export
📄
location.vxL153-167
export fn (self: &Location) toString(): stringDisplay: "America/New_York (UTC-5)"
Receiver: self: &Location (immutable reference)
Returns: string
time
📄
native.linux.vxcL5-5
extern fn time(t: Ptr<i64!>): i64;Parameters:
| Name | Type |
|---|---|
t | Ptr<i64!> |
Returns: i64;
localtime_r
📄
native.linux.vxcL6-6
extern fn localtime_r(timep: Ptr<i64>, result: Ptr<Opaque!>): Ptr<Opaque>;Parameters:
| Name | Type |
|---|---|
timep | Ptr<i64> |
result | Ptr<Opaque!> |
Returns: Ptr<Opaque>;
vex_tz_offset_at
📄
native.linux.vxcL25-25
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64;
vex_tz_exists
📄
native.linux.vxcL26-26
extern fn vex_tz_exists(name: Ptr<u8>): i32;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32;
time
📄
native.macos.vxcL5-5
extern fn time(t: Ptr<i64!>): i64;Parameters:
| Name | Type |
|---|---|
t | Ptr<i64!> |
Returns: i64;
localtime_r
📄
native.macos.vxcL6-6
extern fn localtime_r(timep: Ptr<i64>, result: Ptr<Opaque!>): Ptr<Opaque>;Parameters:
| Name | Type |
|---|---|
timep | Ptr<i64> |
result | Ptr<Opaque!> |
Returns: Ptr<Opaque>;
vex_tz_offset_at
📄
native.macos.vxcL25-25
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64;
vex_tz_exists
📄
native.macos.vxcL26-26
extern fn vex_tz_exists(name: Ptr<u8>): i32;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32;
GetTimeZoneInformation
📄
native.windows.vxcL27-27
extern fn GetTimeZoneInformation(lpTimeZoneInformation: Ptr<TIME_ZONE_INFORMATION!>): u32;Parameters:
| Name | Type |
|---|---|
lpTimeZoneInformation | Ptr<TIME_ZONE_INFORMATION!> |
Returns: u32;
vex_tz_offset_at
📄
native.windows.vxcL31-31
extern fn vex_tz_offset_at(name: Ptr<u8>, unix_sec: i64): i64;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
unix_sec | i64 |
Returns: i64;
vex_tz_exists
📄
native.windows.vxcL32-32
extern fn vex_tz_exists(name: Ptr<u8>): i32;Parameters:
| Name | Type |
|---|---|
name | Ptr<u8> |
Returns: i32;
vex_time_current_ns
📄
runtime.vxcL5-5
extern fn vex_time_current_ns(): u64;Returns: u64;
vex_monotonic_ns
📄
runtime.vxcL6-6
extern fn vex_monotonic_ns(): u64;Returns: u64;
vex_nanosleep
📄
runtime.vxcL7-7
extern fn vex_nanosleep(nanos: i64)Parameters:
| Name | Type |
|---|---|
nanos | i64 |
year 🔓 export
📄
time_type.vxL39-39
export fn (self: &DateTimeParts) year(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
month 🔓 export
📄
time_type.vxL40-40
export fn (self: &DateTimeParts) month(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
day 🔓 export
📄
time_type.vxL41-41
export fn (self: &DateTimeParts) day(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
hour 🔓 export
📄
time_type.vxL42-42
export fn (self: &DateTimeParts) hour(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
minute 🔓 export
📄
time_type.vxL43-43
export fn (self: &DateTimeParts) minute(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
second 🔓 export
📄
time_type.vxL44-44
export fn (self: &DateTimeParts) second(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
weekday 🔓 export
📄
time_type.vxL45-45
export fn (self: &DateTimeParts) weekday(): i32Receiver: self: &DateTimeParts (immutable reference)
Returns: i32
Time.now 🔓 export
📄
time_type.vxL83-86
export fn Time.now(): TimeReturns: Time
Time.unix 🔓 export
📄
time_type.vxL88-93
export fn Time.unix(sec: i64, nsec: i64): TimeParameters:
| Name | Type |
|---|---|
sec | i64 |
nsec | i64 |
Returns: Time
Time.checkedUnix 🔓 export
📄
time_type.vxL96-100
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:
| Name | Type | Description |
|---|---|---|
sec | i64 | Signed Unix seconds |
nsec | i64 | Signed additional nanoseconds, normalized with seconds |
Returns: Option<Time>
Time.fromUnixNanos 🔓 export
📄
time_type.vxL103-105
export fn Time.fromUnixNanos(ns: i64): TimeConstructs an absolute time from nanoseconds since the Unix epoch.
Parameters:
| Name | Type |
|---|---|
ns | i64 |
Returns: Time
clone 🔓 export
📄
time_type.vxL119-121
export fn (self: &Time) clone(): TimeReceiver: self: &Time (immutable reference)
Returns: Time
cmp 🔓 export
📄
time_type.vxL123-127
export fn (self: &Time) cmp(other: &Time): i32Receiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: i32
op== 🔓 export
📄
time_type.vxL129-129
export fn (self: &Time) op==(other: &Time): boolReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: bool
op< 🔓 export
📄
time_type.vxL130-130
export fn (self: &Time) op<(other: &Time): boolReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: bool
op> 🔓 export
📄
time_type.vxL131-131
export fn (self: &Time) op>(other: &Time): boolReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: bool
op<= 🔓 export
📄
time_type.vxL132-132
export fn (self: &Time) op<=(other: &Time): boolReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: bool
op>= 🔓 export
📄
time_type.vxL133-133
export fn (self: &Time) op>=(other: &Time): boolReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
other | &Time |
Returns: bool
toString 🔓 export
📄
time_type.vxL135-152
export fn (self: &Time) toString(): stringReceiver: self: &Time (immutable reference)
Returns: string
writeRFC3339MillisTo 🔓 export
📄
time_type.vxL159-179
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:
| Name | Type |
|---|---|
out | &StringBuilder! |
unix 🔓 export
📄
time_type.vxL181-183
export fn (self: &Time) unix(): i64Receiver: self: &Time (immutable reference)
Returns: i64
unixNano 🔓 export
📄
time_type.vxL186-188
export fn (self: &Time) unixNano(): i64Total nanoseconds elapsed since the Unix epoch.
Receiver: self: &Time (immutable reference)
Returns: i64
unixMilli 🔓 export
📄
time_type.vxL191-193
export fn (self: &Time) unixMilli(): i64Total milliseconds elapsed since the Unix epoch, rounded toward the past.
Receiver: self: &Time (immutable reference)
Returns: i64
unixMicro 🔓 export
📄
time_type.vxL196-198
export fn (self: &Time) unixMicro(): i64Total microseconds elapsed since the Unix epoch, rounded toward the past.
Receiver: self: &Time (immutable reference)
Returns: i64
nanosecond 🔓 export
📄
time_type.vxL201-207
export fn (self: &Time) nanosecond(): i64Nanosecond offset within the current Unix second (0..999_999_999).
Receiver: self: &Time (immutable reference)
Returns: i64
checkedAdd 🔓 export
📄
time_type.vxL209-213
export fn (self: &Time) checkedAdd(d: Duration): Option<Time>Receiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Option<Time>
add 🔓 export
📄
time_type.vxL215-220
export fn (self: &Time) add(d: Duration): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Time
saturatingAdd 🔓 export
📄
time_type.vxL222-230
export fn (self: &Time) saturatingAdd(d: Duration): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
d | Duration |
Returns: Time
checkedDurationSince 🔓 export
📄
time_type.vxL232-236
export fn (self: &Time) checkedDurationSince(earlier: Time): Option<Duration>Receiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
earlier | Time |
Returns: Option<Duration>
durationSince 🔓 export
📄
time_type.vxL238-243
export fn (self: &Time) durationSince(earlier: Time): DurationReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
earlier | Time |
Returns: Duration
year 🔓 export
📄
time_type.vxL256-259
export fn (self: &Time) year(): i64Receiver: self: &Time (immutable reference)
Returns: i64
month 🔓 export
📄
time_type.vxL261-276
export fn (self: &Time) month(): MonthReceiver: self: &Time (immutable reference)
Returns: Month
day 🔓 export
📄
time_type.vxL278-281
export fn (self: &Time) day(): i64Receiver: self: &Time (immutable reference)
Returns: i64
hour 🔓 export
📄
time_type.vxL283-286
export fn (self: &Time) hour(): i64Receiver: self: &Time (immutable reference)
Returns: i64
minute 🔓 export
📄
time_type.vxL288-291
export fn (self: &Time) minute(): i64Receiver: self: &Time (immutable reference)
Returns: i64
second 🔓 export
📄
time_type.vxL293-296
export fn (self: &Time) second(): i64Receiver: self: &Time (immutable reference)
Returns: i64
weekday 🔓 export
📄
time_type.vxL298-308
export fn (self: &Time) weekday(): WeekdayReceiver: self: &Time (immutable reference)
Returns: Weekday
addDate 🔓 export
📄
time_type.vxL312-336
export fn (self: &Time) addDate(years: i32, months: i32, days: i32): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
years | i32 |
months | i32 |
days | i32 |
Returns: Time
withOffset 🔓 export
📄
time_type.vxL340-342
export fn (self: &Time) withOffset(offsetSec: i64): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
offsetSec | i64 |
Returns: Time
formatWithOffset 🔓 export
📄
time_type.vxL361-403
export fn (self: &Time) formatWithOffset(layout: str, offsetSec: i64): stringReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
layout | str |
offsetSec | i64 |
Returns: string
format 🔓 export
📄
time_type.vxL405-407
export fn (self: &Time) format(layout: str): stringReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
layout | str |
Returns: string
startOf 🔓 export
📄
time_type.vxL413-457
export fn (self: &Time) startOf(unit: str): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
unit | str |
Returns: Time
endOf 🔓 export
📄
time_type.vxL459-497
export fn (self: &Time) endOf(unit: str): TimeReceiver: self: &Time (immutable reference)
Parameters:
| Name | Type |
|---|---|
unit | str |
Returns: Time
Generated by vex-doc v2.0 • 2026-10-28