Skip to content

TimeOfDay

[Source]

An hour:minute:second.nanosecond within a day, with no date and no zone. Range: 00:00:00.000_000_000 .. 23:59:59.999_999_999. No leap-second representation (POSIX model).

class val TimeOfDay

Constructors

create

[Source]

Construct from hour/minute/second/nanosecond. Errors if any field is out of range.

new val create(
  hour': U8 val,
  minute': U8 val,
  second': U8 val,
  nano': I32 val = 0)
: TimeOfDay val^ ?

Parameters

  • hour': U8 val
  • minute': U8 val
  • second': U8 val
  • nano': I32 val = 0

Returns


midnight

[Source]

00:00:00.000_000_000 — non-partial because midnight is always valid. Used for stubs and as a safe default.

new val midnight()
: TimeOfDay val^

Returns


noon

[Source]

12:00:00.000_000_000 — non-partial; always valid.

new val noon()
: TimeOfDay val^

Returns


from_total_nanos

[Source]

Construct from nanoseconds since midnight (0 .. 86_399_999_999_999). Errors if n is out of range. Inverse of total_nanos().

new val from_total_nanos(
  n: I64 val)
: TimeOfDay val^ ?

Parameters

Returns


Public Functions

hour

[Source]

fun val hour()
: U8 val

Returns


minute

[Source]

fun val minute()
: U8 val

Returns


second

[Source]

fun val second()
: U8 val

Returns


nano

[Source]

fun val nano()
: I32 val

Returns


total_nanos

[Source]

Nanoseconds since midnight: 0 .. 86_399_999_999_999.

fun val total_nanos()
: I64 val

Returns


compare

[Source]

fun val compare(
  other: TimeOfDay val)
: Compare

Parameters

Returns


eq

[Source]

fun val eq(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


ne

[Source]

fun val ne(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


lt

[Source]

fun val lt(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


le

[Source]

fun val le(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


gt

[Source]

fun val gt(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


ge

[Source]

fun val ge(
  other: TimeOfDay val)
: Bool val

Parameters

Returns


add_nanos

[Source]

Return (new TimeOfDay, days-overflow). Adds n nanoseconds, wrapping within the day; overflow days are reported so the caller can apply them to a Date or ZonedDateTime.

n may be negative, in which case days-overflow can be negative. Example: 23:00 + 2h yields (01:00, +1); 01:00 + (-2h) yields (23:00, -1).

fun val add_nanos(
  n: I64 val)
: (TimeOfDay val , I32 val)

Parameters

Returns


string

[Source]

ISO 8601 time format. Emits "HH:MM:SS" when nanoseconds are zero, or "HH:MM:SS.nnnnnnnnn" (zero-padded to 9 digits) otherwise.

fun val string()
: String iso^

Returns