time

Types

Type representing a time, either with or without a date.

pub type Time {
  LocalTime(
    hour: Int,
    minute: Int,
    second: Int,
    millisecond: Int,
  )
  PreciseTime(
    hour: Int,
    minute: Int,
    second: Int,
    millisecond: Int,
    microsecond: Int,
    nanosecond: Int,
  )
}

Constructors

  • LocalTime(hour: Int, minute: Int, second: Int, millisecond: Int)

    Time without a date, such as 12:30:45.123

  • PreciseTime(
      hour: Int,
      minute: Int,
      second: Int,
      millisecond: Int,
      microsecond: Int,
      nanosecond: Int,
    )

    Time with a date, such as 2024-06-01T12:30:45.123Z

Values

pub fn describe_time(time: Time) -> String

Function to describe a time as a string.

pub fn now(utc_offset utc_offset: Int) -> Time

Function to get the current time without a date, with precision up to milliseconds.

pub fn precise_now(utc_offset utc_offset: Int) -> Time

Function to get the current time with high precision, including microseconds and nanoseconds.

Search Document