Skip to content

Time

Represents the time of day in hours, minutes, seconds and optionally milliseconds or nanoseconds.

  • Kotlin Definition: TimeDefinition
  • Kotlin Value : LocalTime
  • Maryk Yaml Definition: Time
  • Value
  • Map key or value
  • Inside List/Set
  • required - default true
  • final - default false
  • unique - default false
  • minValue - default false. Minimum value
  • maxValue - default false. Maximum value
  • default - the default value to be used if value was not set.
  • precision - The precision to which the time is stored and transported. SECONDS (default), MILLIS or NANOS.

Example of a String property definition for use within a Model

val arrivalTime by time(
index = 1u,
required = false,
final = true,
unique = true,
default = LocalTime(12, 0),
minValue = LocalTime(8, 30),
maxValue = LocalTime(18, 0),
precision = TimePrecision.MILLIS
)

Example of a separate String property definition

val def = TimeDefinition(
required = false,
final = true,
unique = true,
default = LocalTime(12, 0),
minValue = LocalTime(8, 30),
maxValue = LocalTime(18, 0),
precision = TimePrecision.MILLIS
)

It depends on the precision of the Time how it will be stored

  • SECONDS - 3 byte unsigned integer counting the seconds from midnight (0:00am)
  • MILLIS - 4 byte unsigned integer counting the milliseconds from midnight (0:00am)
  • MILLIS - 6 byte unsigned long counting the nanoseconds from midnight (0:00am)

The bytes are transported in a different way depending on the precision of time.

  • SECONDS - VarInt integer counting the seconds from midnight
  • MILLIS - VarInt integer counting the milliseconds from midnight
  • NANOS - VarInt integer counting the nanoseconds from midnight

ISO8601 String: HH:MM:SS.SSSSSSSSS

Example: 20:47:22.825635486