Packages

builtin
cbindgen
core
core.alloc
core.alloc.arena
core.alloc.atomic
core.alloc.debug
core.alloc.fixed
core.alloc.gc
core.alloc.heap
core.alloc.log
core.alloc.memwatch
core.alloc.pool
core.alloc.ring
core.arg_parse
core.array
core.avl_tree
core.bucket_array
core.conv
core.crypto
core.crypto.keys
core.doc
core.encoding
core.encoding.base64
core.encoding.csv
core.encoding.hex
core.encoding.json
core.encoding.kdl
core.encoding.osad
core.encoding.utf8
core.encoding.xml
core.hash
core.hash.md5
core.hash.sha1
core.hash.sha256
core.heap
core.intrinsics
core.intrinsics.atomics
core.intrinsics.onyx
core.intrinsics.types
core.intrinsics.wasm
core.io
core.io.binary
core.iter
core.js
core.list
core.map
core.math
core.memory
core.misc
core.net
core.os
core.random
core.set
core.slice
core.string
core.sync
core.test
core.thread
core.time
main
runtime
runtime.info
runtime.platform
runtime.vars
simd

package core.time

Date
Date :: struct {
    year: i32
    month: i32
    day: i32
}
Methods
Date.add_days
Date.add_days :: (d: Date, days: i32) -> Date
Date.add_months
Date.add_months :: (d: Date, months: i32) -> Date
Date.day_of_week
Date.day_of_week :: (d: Date) -> i32
Date.end_of_month
Date.end_of_month :: (d: Date) -> Date
Date.is_after
Date.is_after :: (d1: Date, d2: Date) -> bool
Date.is_before
Date.is_before :: (d1: Date, d2: Date) -> bool
Date.make
Date.make :: (year: i32, month: i32, day: i32) -> Date
Date.month_duration_in_days
Date.month_duration_in_days :: (year: i32, month: i32) -> u32
Date.start_of_month
Date.start_of_month :: (d: Date) -> Date
Date.today
Date.today :: () -> Date
Timestamp
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
Timestamp.as_date :: (t: Timestamp) -> Date

Converts the month, day and year fields into a Date.

Timestamp.format
Timestamp.format :: (t: Timestamp, format: [] u8) -> [] u8

Formats a timestamp into a string.

Timestamp.from_date
Timestamp.from_date :: (d: Date) -> Timestamp

Converts a Date into a Timestamp.

Timestamp.to_epoch
Timestamp.to_epoch :: (tm: Timestamp) -> i64
gmtime
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
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

now
now :: () -> Timestamp

Returns the current system time at UTC-0.

strftime
strftime :: (format_: [] u8, tm: &Timestamp) -> [] u8
strftime :: (buf: [] u8, format_: [] u8, tm: &Timestamp) -> [] u8
strftime :: (w: &Writer, format_: [] u8, tm: &Timestamp) -> void
strptime
strptime :: (buf: [] u8, format: [] u8) -> ? Timestamp
strptime :: (buf_: [] u8, format_: [] u8, tm: &Timestamp) -> bool