/chrono
High-precision clocks (Steady-Clock), civil dates/times (Date, Time, Date-Time), UTC Instants, IANA Zoned-Date-Time, and Duration/Span arithmetic powered by jiff.
Functions & symbols#
!=#
Returns `true` if two temporal values, durations, or spans are unequal.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(!= (Date 2026 3 15) (Date 2026 3 20))+#
Adds a `Duration` or `Span` to a temporal point, or sums two durations/spans.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Base temporal point or duration |
delta | Span | Duration | Temporal | required | Delta duration/span or second instant for difference |
Any(+ (Date 2026 5 1) (chrono/days 7))-#
Subtracts a `Duration` or `Span` from a temporal point, or computes the elapsed duration/span between two points.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Base temporal point or duration |
delta | Span | Duration | Temporal | required | Delta duration/span or second instant for difference |
Any(- (Date 2026 5 10) (Date 2026 5 1))<#
Returns `true` if `left` occurs chronologically before (or is shorter than) `right`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(< (Date 2026 3 15) (Date 2026 3 20))<=#
Returns `true` if `left` occurs before or at the same instant as `right`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(<= (Date 2026 3 15) (Date 2026 3 20))==#
Returns `true` if two temporal values, durations, or spans are equal.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(== (Date 2026 3 15) (Date 2026 3 20))>#
Returns `true` if `left` occurs chronologically after (or is longer than) `right`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(> (Date 2026 3 15) (Date 2026 3 20))>=#
Returns `true` if `left` occurs after or at the same instant as `right`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
left | Date | Time | Date-Time | Instant | Steady-Instant | Zoned-Date-Time | Duration | Span | required | Left temporal value or duration |
right | Any | required | Comparable temporal value or duration |
Any(>= (Date 2026 3 15) (Date 2026 3 20))Date#
Constructs a civil calendar `Date` without time-of-day or timezone.
| Parameter | Type | Optional | Description |
|---|---|---|---|
year_or_str | Int | String | Map | required | Calendar year, ISO-8601 date string (`"2026-03-15"`), or fields map |
month | Int | optional | Month of year (1–12) |
day | Int | optional | Day of month (1–31) |
Any(Date 2026 5 1)Date-Time#
Constructs a civil `Date-Time` combining date and time without timezone offset.
| Parameter | Type | Optional | Description |
|---|---|---|---|
date_or_year | Date | Int | String | required | Civil Date, year Int, or ISO-8601 datetime string |
time_or_month | Time | Int | optional | Civil Time or month Int |
Any(Date-Time 2026 5 1 9 0 0)Date-Time/local#
Returns the current civil `Date-Time` in the system's local timezone.
Any(Date-Time/local)Date-Time/utc#
Returns the current civil `Date-Time` in UTC.
Any(Date-Time/utc)Date/local#
Returns today's civil `Date` in the system's local timezone.
Any(Date/local)Date/utc#
Returns today's civil `Date` in UTC.
Any(Date/utc)Duration#
Constructs an exact physical `Duration` (fixed hours/minutes/seconds/subseconds).
| Parameter | Type | Optional | Description |
|---|---|---|---|
args | KeySymbol | Int | String | Map | required | Key-value unit pairs (:hours, :minutes, :seconds, :millis, :micros, :nanos) or ISO-8601 duration string |
Any(Duration :minutes 5 :seconds 30)Instant#
Constructs an exact physical UTC `Instant` on the Unix epoch timeline (defaults to current time).
| Parameter | Type | Optional | Description |
|---|---|---|---|
value | Int | String | Map | optional | Optional Unix epoch seconds, RFC 3339 string, or {:millis ... :nanos ...} map |
Any(Instant)(Instant "2026-05-01T12:00:00Z")Span#
Constructs a calendar-aware `Span` supporting variable-length units like years, months, and weeks.
| Parameter | Type | Optional | Description |
|---|---|---|---|
args | KeySymbol | Int | String | Map | required | Key-value unit pairs (:years, :months, :weeks, :days, :hours, :minutes, :seconds, ...) or ISO-8601 span string |
Any(Span :months 1 :days 5)Steady-Clock/elapsed#
Returns the exact elapsed `Duration` since `since`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
since | Steady-Instant | required | Earlier Steady-Instant captured via Steady-Clock/now |
Any(let dt (Steady-Clock/elapsed start))Steady-Clock/measure#
Executes `func` and returns `{:value result :duration elapsed-duration}`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
func | Func | required | Zero-argument function to benchmark |
Any(let res (Steady-Clock/measure (Func () (work))))Steady-Clock/now#
Captures the current reading of the host monotonic high-resolution clock.
Any(let start (Steady-Clock/now))Steady-Instant#
Captures a monotonic clock reading immune to system wall-clock adjustments.
Any(let t0 (Steady-Clock/now))Time#
Constructs a civil wall-clock `Time` without date or timezone.
| Parameter | Type | Optional | Description |
|---|---|---|---|
hour_or_str | Int | String | Map | required | Hour (0–23), ISO-8601 time string, or fields map |
minute | Int | optional | Minute (0–59) |
second | Int | optional | Optional second (0–59) |
nanosecond | Int | optional | Optional nanosecond (0–999_999_999) |
Any(Time 14 30 0)Time/local#
Returns the current wall-clock `Time` in the system's local timezone.
Any(Time/local)Time/utc#
Returns the current wall-clock `Time` in UTC.
Any(Time/utc)Zoned-Date-Time#
Constructs a timezone-aware `Zoned-Date-Time` referencing an IANA timezone database zone.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | String | Instant | Date-Time | optional | RFC 9557 string or temporal value to project |
timezone | String | optional | IANA timezone name (e.g. "America/New_York", "UTC") |
disambiguation | KeySymbol | optional | Optional DST disambiguation (:compatible, :earlier, :later, :reject) |
Any(Zoned-Date-Time (Instant) "Europe/Athens")Zoned-Date-Time/in#
Returns the current wall time in the specified IANA `timezone`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
timezone | String | required | IANA timezone identifier |
Any(Zoned-Date-Time/in "Asia/Tokyo")Zoned-Date-Time/local#
Returns the current `Zoned-Date-Time` in the host OS timezone.
Any(Zoned-Date-Time/local)Zoned-Date-Time/utc#
Returns the current `Zoned-Date-Time` in UTC.
Any(Zoned-Date-Time/utc)age#
Computes exact human calendar age between `birth_date` and `reference` as a balanced `Span`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
birth_date | Date | Date-Time | Zoned-Date-Time | required | Start date |
reference | Date | Date-Time | Zoned-Date-Time | optional | Reference date (defaults to today UTC) |
Any(age (Date 1995 6 15) (Date 2026 6 15))date-diff#
Computes the calendar/time difference between two temporal points as a `Span`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
start | Date | Time | Date-Time | Instant | Zoned-Date-Time | required | Start temporal point |
end | Date | Time | Date-Time | Instant | Zoned-Date-Time | required | End temporal point |
options | Map | optional | Optional {:largest :unit :smallest :unit} |
Any(date-diff (Date 2026 1 1) (Date 2026 3 1))date-round#
Rounds a temporal value to `unit` with optional increment and rounding mode.
| Parameter | Type | Optional | Description |
|---|---|---|---|
unit | KeySymbol | String | required | Smallest target unit (:day, :hour, :minute, :second, :millis, ...) |
temporal | Time | Date-Time | Instant | Zoned-Date-Time | required | Temporal value to round |
options | Map | optional | Rounding options {:mode :half-expand :increment 1} |
Any(date-round :minute (Instant))date-trunc#
Truncates smaller components of `temporal` down to the start of `unit`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
unit | KeySymbol | String | required | Truncation unit (:year, :month, :day, :hour, :minute, :second) |
temporal | Date | Time | Date-Time | Zoned-Date-Time | Instant | required | Temporal value to truncate |
Any(date-trunc :day (Date-Time/utc))day-of-week#
Returns the 1-based Monday-indexed day of the week (1 = Monday .. 7 = Sunday).
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date or datetime to inspect |
Any(day-of-week (Date 2026 5 1))day-of-week-iso#
Returns the ISO-8601 weekday number (1 = Monday through 7 = Sunday).
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date or datetime to inspect |
Any(day-of-week-iso (Date/utc))day-of-week-symbol#
Returns the weekday as a KeySymbol (`:mon`, `:tue`, `:wed`, `:thu`, `:fri`, `:sat`, `:sun`).
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date or datetime to inspect |
Any(day-of-week-symbol (Date 2026 5 1))day-of-year#
Returns the ordinal day within the year (1–365 or 1–366).
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date or datetime to inspect |
Any(day-of-year (Date 2026 12 31))days#
Constructs a calendar/clock `Span` representing `n` calendar days.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of calendar days |
Any(+ (Date 2026 1 1) (days 2))epoch-millis-of#
Extracts Unix epoch milliseconds from a temporal value.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Instant | Zoned-Date-Time | Date-Time | required | Temporal value |
Any(epoch-millis-of (Instant))epoch-nanos-of#
Extracts Unix epoch nanoseconds from a temporal value.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Instant | Zoned-Date-Time | Date-Time | required | Temporal value |
Any(epoch-nanos-of (Instant))epoch-seconds-of#
Extracts whole Unix epoch seconds from a temporal value.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Instant | Zoned-Date-Time | Date-Time | required | Temporal value |
Any(epoch-seconds-of (Instant))format-date#
Formats a temporal value using a `strftime`-compatible pattern string.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Date | Time | Date-Time | Zoned-Date-Time | Instant | required | Temporal value to format |
pattern | String | required | strftime-compatible format string (e.g. "%Y-%m-%d %H:%M") |
Any(format-date (Date 2026 5 1) "%Y-%m-%d")get-epoch-millis#
Returns the current UTC Unix timestamp in milliseconds.
Any(get-epoch-millis)get-epoch-nanos#
Returns the current UTC Unix timestamp in nanoseconds.
Any(get-epoch-nanos)get-epoch-seconds#
Returns the current UTC Unix timestamp in whole seconds.
Any(get-epoch-seconds)hours#
Constructs a calendar/clock `Span` representing `n` hours.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of hours |
Any(+ (Date 2026 1 1) (hours 2))is-leap-year?#
Returns `true` if the year is a Gregorian leap year.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Date | Date-Time | Zoned-Date-Time | Int | required | Temporal value or 4-digit year integer |
Any(is-leap-year? 2024) ; -> trueis-weekday?#
Returns `true` when `date` falls Monday through Friday.
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date to check |
Any(is-weekday? (Date/local))is-weekend?#
Returns `true` when `date` falls on Saturday or Sunday.
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date to check |
Any(is-weekend? (Date/local))micros#
Constructs an exact signed `Duration` representing `n` microseconds.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of microseconds |
Any(+ (Instant) (micros 30))millis#
Constructs an exact signed `Duration` representing `n` milliseconds.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of milliseconds |
Any(+ (Instant) (millis 30))minutes#
Constructs a calendar/clock `Span` representing `n` minutes.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of minutes |
Any(+ (Date 2026 1 1) (minutes 2))months#
Constructs a calendar/clock `Span` representing `n` calendar months.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of calendar months |
Any(+ (Date 2026 1 1) (months 2))nanos#
Constructs an exact signed `Duration` representing `n` nanoseconds.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of nanoseconds |
Any(+ (Instant) (nanos 30))offset-of#
Returns the UTC offset in whole seconds for the `Zoned-Date-Time` at that instant.
| Parameter | Type | Optional | Description |
|---|---|---|---|
zoned | Zoned-Date-Time | required | Zoned datetime to inspect |
Any(offset-of (Zoned-Date-Time/utc)) ; -> 0seconds#
Constructs an exact signed `Duration` representing `n` seconds.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of seconds |
Any(+ (Instant) (seconds 30))span-round#
Balances or rounds a `Span` across calendar/time units.
| Parameter | Type | Optional | Description |
|---|---|---|---|
unit_or_span | KeySymbol | Span | required | Smallest unit KeySymbol or Span |
span | Span | optional | Span to balance/round when first arg is unit |
options | Map | optional | Balancing options {:largest :year :relative-to date} |
Any(span-round :second (chrono/Span :millis 65432))span-total#
Computes the exact floating-point total length of a `Span` in `unit`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
unit | KeySymbol | required | Target unit (:days, :hours, :minutes, :seconds, ...) |
span | Span | Duration | required | Span or Duration to measure |
options | Map | optional | Optional {:relative-to ...} reference for calendar units |
Any(span-total :hours (chrono/Span :days 2 :hours 12)) ; -> 60.0timezone-of#
Returns the IANA timezone identifier (e.g. `"Europe/Athens"`) or offset string.
| Parameter | Type | Optional | Description |
|---|---|---|---|
zoned | Zoned-Date-Time | required | Zoned datetime to inspect |
Any(timezone-of (Zoned-Date-Time/utc)) ; -> "UTC"to-date#
Extracts or parses a civil `Date`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Date-Time | Zoned-Date-Time | String | required | Value to project to civil Date |
Any(to-date (Date-Time/utc))to-date-time#
Converts a zoned datetime or ISO string into a timezone-naive `Date-Time`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Zoned-Date-Time | String | required | Value to convert to civil Date-Time |
Any(to-date-time (Zoned-Date-Time/utc))to-duration#
Converts a fixed-unit `Span`, ISO string, or map into an exact `Duration`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
value | Span | String | Map | required | Value to convert to Duration |
Any(to-duration (chrono/minutes 10))to-instant#
Converts a zoned datetime, ISO string, or epoch integer into a physical `Instant`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Zoned-Date-Time | String | Int | required | Value to convert to Instant |
Any(to-instant (Zoned-Date-Time/local))to-iso-string#
Serializes a temporal value or span in canonical ISO-8601 format.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Date | Time | Date-Time | Zoned-Date-Time | Instant | Duration | Span | required | Temporal value |
Any(to-iso-string (Date 2026 5 1))to-rfc-3339#
Formats an `Instant` or `Zoned-Date-Time` as an RFC 3339 UTC/offset timestamp.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Instant | Zoned-Date-Time | Date-Time | required | Temporal instant |
Any(to-rfc-3339 (Instant))to-span#
Converts a `Duration`, ISO string, or map into a calendar `Span`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
value | Duration | String | Map | required | Value to convert to Span |
Any(to-span (chrono/seconds 90))to-string#
Formats any `/chrono` temporal or duration value as a human-readable string.
| Parameter | Type | Optional | Description |
|---|---|---|---|
temporal | Any | required | Chrono temporal or duration value |
Any(to-string (chrono/minutes 5))to-time#
Extracts or parses a civil `Time`.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Date-Time | Zoned-Date-Time | String | required | Value to project to civil Time |
Any(to-time (Date-Time/local))to-zoned-date-time#
Projects an `Instant` or `Date-Time` into the given IANA timezone.
| Parameter | Type | Optional | Description |
|---|---|---|---|
target | Instant | Date-Time | Zoned-Date-Time | String | required | Temporal value to attach timezone to |
timezone | String | required | IANA timezone name |
disambiguation | KeySymbol | optional | Optional DST disambiguation strategy |
Any(to-zoned-date-time (Instant) "UTC")weekday-of#
Alias of `day-of-week` returning ISO Monday=1 .. Sunday=7 weekday integer.
| Parameter | Type | Optional | Description |
|---|---|---|---|
date | Date | Date-Time | Zoned-Date-Time | required | Date or datetime to inspect |
Any(weekday-of (Date/local))weeks#
Constructs a calendar/clock `Span` representing `n` 7-day weeks.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of 7-day weeks |
Any(+ (Date 2026 1 1) (weeks 2))with-timezone#
Projects a temporal instant into a different IANA timezone.
| Parameter | Type | Optional | Description |
|---|---|---|---|
zoned | Zoned-Date-Time | Instant | Date-Time | required | Temporal value |
timezone | String | required | Target IANA timezone identifier |
disambiguation | KeySymbol | optional | Optional DST disambiguation option |
Any(with-timezone (Zoned-Date-Time/utc) "America/New_York")years#
Constructs a calendar/clock `Span` representing `n` calendar years.
| Parameter | Type | Optional | Description |
|---|---|---|---|
n | Int | required | Number of calendar years |
Any(+ (Date 2026 1 1) (years 2))