← index

Time

inherits Object

A wall-clock time of day — no date, no zone: the type for "the shop opens at 9:40". Arithmetic with a Duration WRAPS around midnight (a zoneless clock has nowhere else to go); until: answers the signed Duration between two clock readings within one day. It meets dates through Date#atTime:zone: and DateTime#time.

((Time.hour:23 minute:30) + (Duration.hours:1)).s     "* -> 00:30:00
extended at core/16-serialize.qn:33

The wall-clock time, as ISO 8601 ('09:40:00'; Time.parse: reads it back).

Class methods

hour:Integer minute:Integer

The wall-clock time at the given hour (0–23) and minute (0–59), at zero seconds. Out-of-range components throw a ValueError.

(Time.hour:9 minute:40).s     "* -> 09:40:00

native

hour:Integer minute:Integer second:Integer

The wall-clock time at the given hour, minute, and second (0–59).

native

midnight

00:00:00 — the first instant of a day.

native

parse:String

The time an ISO 8601 string ('09:40:00', fractional seconds allowed) denotes; not parseable → ValueError.

(Time.parse:'09:40:30').second     "* -> 30

native

Instance methods

+:Duration

The clock reading a Duration later, WRAPPING around midnight — a zoneless clock time has no date to carry into.

((Time.hour:23 minute:30) + (Duration.hours:1)).s     "* -> 00:30:00

native

-:Duration

The clock reading a Duration earlier, wrapping below midnight.

native

<:Time

Whether the receiver is the earlier clock reading (midnight is least). Only <: is native; the rest derive on Object.

native

==:

Whether the argument is the same clock reading. A non-Time is simply unequal.

native

asData

core/16-serialize.qn:34

hour

The hour component (0–23).

native

minute

The minute component (0–59).

native

nanosecond

The subsecond component in nanoseconds (0–999,999,999).

native

s

The ISO 8601 time string (subseconds only when present).

(Time.hour:9 minute:40).s     "* -> 09:40:00

native

second

The second component (0–59).

native

until:Time

The signed Duration from the receiver to the argument, read within one day — negative when the argument is the earlier clock reading (nothing wraps: 23:00 until 01:00 is -22h, not 2h).

((Time.hour:9 minute:0).until:(Time.hour:17 minute:30)).s     "* -> 8h 30m

native