EgretDoc
Back to Home
Location:system/time

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
Signatureextern 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
Signatureextern 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
Signatureextern 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
Signatureextern 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
Signatureextern 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
Signatureextern 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
Signaturefunc now_ms() -> Int
func now_ms() -> Int {
    return __now_ms();
}
@briefGet current timestamp (milliseconds)
@detailsReturns the runtime clock in milliseconds.
@returnCurrent timestamp in milliseconds
functiontime::now_us
Signaturefunc now_us() -> Int
func now_us() -> Int {
    return __now_us();
}
@briefGet current timestamp (microseconds)
@detailsReturns the runtime clock in microseconds.
@returnCurrent timestamp in microseconds
functiontime::sleep
Signaturefunc sleep(ms: Int) -> Void
func 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
Signaturefunc unix_sec() -> Int
func 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
Signaturefunc unix_usec() -> Int
func 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
Signaturefunc gettimeofday() -> Int, ErrCode
func 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
Signaturefunc getdaytime() -> Int, ErrCode
func 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
Signaturefunc date(format: String = "%Y-%m-%d %H:%M:%S") -> String, ErrCode
func 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).