Module: time.time
Source: ./time/time.reef
Overview
time/time - Time and date functions
Provides functions for working with time and dates using the Gregorian calendar. Times are represented as Unix timestamps (seconds since 1970-01-01 00:00:00 UTC). All date/time extraction functions return UTC values.
Usage: import time.time let now = time_now() let year = time_year(now) let formatted = time_format_iso(now)
Functions
fn time_now(): int
fn time_now_millis(): int
fn is_leap_year(year: int): bool
fn days_in_month(year: int, month: int): int
fn days_in_year(year: int): int
Days in year
fn timestamp_to_days(timestamp: int): int
Internal: Get total days since epoch and remaining seconds Returns days in first element, remaining seconds in internal state
fn timestamp_seconds_of_day(timestamp: int): int
fn days_to_year_and_yday(total_days: int, out_yday: [int]): int
Calculate year and day-of-year from days since epoch Returns year, stores day-of-year internally for next call
fn time_year(timestamp: int): int
fn time_yearday(timestamp: int): int
fn time_month(timestamp: int): int
fn time_day(timestamp: int): int
fn time_hour(timestamp: int): int
fn time_minute(timestamp: int): int
fn time_second(timestamp: int): int
fn time_weekday(timestamp: int): int
fn time_make(year: int, month: int, day: int, hour: int, minute: int, second: int): int
fn digit_char(n: int): char
fn time_format_iso(timestamp: int): string
Format as ISO 8601: YYYY-MM-DDTHH:MM:SS
fn time_format_date(timestamp: int): string
Format as date: YYYY-MM-DD
fn time_format_time(timestamp: int): string
Format as time: HH:MM:SS
fn time_add_seconds(timestamp: int, seconds: int): int
fn time_add_minutes(timestamp: int, minutes: int): int
fn time_add_hours(timestamp: int, hours: int): int
fn time_add_days(timestamp: int, days: int): int
fn time_diff(t1: int, t2: int): int
fn iso_is_digit(c: char): bool
fn iso_digit_value(c: char): int
fn iso_read_digits(s: string, start: int, count: int, slen: int, out: [int]): bool
Read exactly count digits starting at index start. Returns the parsed
value via out[0] and true on success, false on insufficient or non-digit
input.
fn time_parse_iso(s: string): result.Result[int, error.Error]
Generated by reefc doc