Module
Module documentation.
moduletime
@briefTime utilities
@detailsLightweight wrappers for timestamps (milliseconds) and sleeping.
@see
- index.html
Classes
Classes and inheritance.
Functions
Free functions and class methods.
functiontime::__now_ms
Signature
extern func __now_ms() -> Int;extern func __now_ms() -> Int;
/*
@brief Binds the low-level runtime symbol `__now_us`.@briefBinds the low-level runtime symbol `__now_ms`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functiontime::__now_us
Signature
extern func __now_us() -> Int;extern func __now_us() -> Int;
/*
@brief Binds the low-level runtime symbol `__sleep_ms`.@briefBinds the low-level runtime symbol `__now_us`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functiontime::__sleep_ms
Signature
extern func __sleep_ms(ms: Int) -> Int;extern func __sleep_ms(ms: Int) -> Int;
/*
@brief Binds the low-level runtime symbol `__time_unix_sec`.@briefBinds the low-level runtime symbol `__sleep_ms`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- msDuration in milliseconds used for sleeping, waiting, or timeout calculation.
@returnReturns the operation result as `Int`.
functiontime::__time_unix_sec
Signature
extern func __time_unix_sec() -> Int;extern func __time_unix_sec() -> Int;
/*
@brief Binds the low-level runtime symbol `__time_unix_usec`.@briefBinds the low-level runtime symbol `__time_unix_sec`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functiontime::__time_unix_usec
Signature
extern func __time_unix_usec() -> Int;extern func __time_unix_usec() -> Int;
/*
@brief Binds the low-level runtime symbol `__time_date`.@briefBinds the low-level runtime symbol `__time_unix_usec`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@returnReturns the operation result as `Int`.
functiontime::__time_date
Signature
extern func __time_date(format: String) -> String;extern func __time_date(format: String) -> String;
/*@briefBinds the low-level runtime symbol `__time_date`.
@detailsThis function is an external entry point used by system modules to access native runtime capabilities such as filesystem, networking, threading, GC, cryptography, or platform operations. Prefer the safe wrapper functions in the same file when available. When calling this entry directly, pass validated arguments that match the signature and handle failures according to the return-value convention.
@param
- formatFormat string that controls how arguments are converted to text.
@returnReturns the operation result as `String`.
functiontime::now_ms
Signature
func now_ms() -> Intfunc now_ms() -> Int {
return __now_ms();
}@briefGet current timestamp (milliseconds)
@detailsReturns the runtime clock in milliseconds.
@returnCurrent timestamp in milliseconds
functiontime::now_us
Signature
func now_us() -> Intfunc now_us() -> Int {
return __now_us();
}@briefGet current timestamp (microseconds)
@detailsReturns the runtime clock in microseconds.
@returnCurrent timestamp in microseconds
functiontime::sleep
Signature
func sleep(ms: Int) -> Voidfunc sleep(ms: Int) -> Void {
_ = __sleep_ms(ms);
}@briefSleep for a duration in milliseconds
@detailsSleeps for the requested duration using the runtime sleep primitive.
@param
- msSleep duration in milliseconds
@returnVoid
functiontime::unix_sec
Signature
func unix_sec() -> Intfunc unix_sec() -> Int {
return __time_unix_sec();
}@briefProvides the system library operation `unix_sec`.
@detailsExecutes the `unix_sec` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functiontime::unix_usec
Signature
func unix_usec() -> Intfunc unix_usec() -> Int {
return __time_unix_usec();
}@briefProvides the system library operation `unix_usec`.
@detailsExecutes the `unix_usec` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns the operation result as `Int`.
functiontime::gettimeofday
Signature
func gettimeofday() -> Int, ErrCodefunc gettimeofday() -> Int, ErrCode {
let us: Int = __time_unix_usec();
if us <= 0 {@briefProvides the system library operation `gettimeofday`.
@detailsExecutes the `gettimeofday` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functiontime::getdaytime
Signature
func getdaytime() -> Int, ErrCodefunc getdaytime() -> Int, ErrCode {
return gettimeofday();
}@briefProvides the system library operation `getdaytime`.
@detailsExecutes the `getdaytime` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functiontime::date
Signature
func date(format: String = "%Y-%m-%d %H:%M:%S") -> String, ErrCodefunc date(format: String = "%Y-%m-%d %H:%M:%S") -> String, ErrCode {
let s: String = __time_date(format);
if std.len(s) == 0 {@briefProvides the system library operation `date`.
@detailsExecutes the `date` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- formatFormat string that controls how arguments are converted to text.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).