package core.time
Date :: struct {
year: i32
month: i32
day: i32
}
Methods
Timestamp :: struct {
sec: i32
min: i32
hour: i32
mday: i32
mon: i32
year: i32
wday: i32
yday: i32
isdst: i32
}
Represents a timestamp broken down by month, day, year, hour, minute, and seconds.
This structure does not represent or store timezone information.
Methods
Timestamp.as_date :: (t: Timestamp) -> Date
Converts the month, day and year fields into a Date
.
Timestamp.format :: (t: Timestamp, format: [] u8) -> [] u8
Formats a timestamp into a string.
gmtime :: (ts: i64, tm: &Timestamp) -> void
gmtime :: (seconds: u64) -> Timestamp
Converts UNIX epoch time to a timestamp, relative to the Greenich mean time. Note, this function is currently not implemented correctly as there is no reliable way to get the current system timezone. It is currently equivalent to gmtime
localtime :: (ts: i64, tm: &Timestamp) -> void
localtime :: (seconds: u64) -> Timestamp
Converts UNIX epoch time to a timestamp, relative to the current timezone.
Note, this function is currently not implemented correctly as there is no reliable way to get the current system timezone. It is currently equivalent to gmtime
strftime :: (format_: [] u8, tm: &Timestamp) -> [] u8
strftime :: (buf: [] u8, format_: [] u8, tm: &Timestamp) -> [] u8
strftime :: (w: &Writer, format_: [] u8, tm: &Timestamp) -> void