Clocks v0.1.0
QueryPerformanceCounter
pub extern func QueryPerformanceCounter(count: *var int64) -> int32
Reads the monotonic performance counter. Writes the current count and returns nonzero. It cannot fail on any system this package supports, and the count is guaranteed not to go backwards — unlike the wall clock, which can. The unit is whatever QueryPerformanceFrequency reports and is not seconds.
See also: https://learn.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter
Parameters
| Name | Type | Description |
|---|---|---|
count | *var int64 | receives the counter's current value |
Returns: non-zero on success
QueryPerformanceFrequency
pub extern func QueryPerformanceFrequency(frequency: *var int64) -> int32
Reads how many performance-counter ticks make one second. Fixed while the system runs, so a caller reads it once rather than per measurement.
Parameters
| Name | Type | Description |
|---|---|---|
frequency | *var int64 | receives the counter's fixed frequency, in counts per second |
Returns: non-zero on success
GetSystemTimePreciseAsFileTime
pub extern func GetSystemTimePreciseAsFileTime(time: *var FileTime)
Reads the current wall-clock time at the highest resolution the system offers. Writes 100-nanosecond intervals since January 1, 1601 UTC. The plain GetSystemTimeAsFileTime is cheaper and coarser, advancing only at the scheduler's tick.
Parameters
| Name | Type | Description |
|---|---|---|
time | *var FileTime | receives the reading |
GetSystemTimeAsFileTime
pub extern func GetSystemTimeAsFileTime(time: *var FileTime)
Reads the current wall-clock time at the system tick's resolution.
See also: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime
Parameters
| Name | Type | Description |
|---|---|---|
time | *var FileTime | receives the reading |
GetLocalTime
pub extern func GetLocalTime(time: *SystemTime)
Retrieves the current local date and time.
See also: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getlocaltime
Parameters
| Name | Type | Description |
|---|---|---|
time | *SystemTime | receives the reading |
GetSystemTime
pub extern func GetSystemTime(time: *SystemTime)
Retrieves the current system date and time in Coordinated Universal Time (UTC) format.
See also: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtime
Parameters
| Name | Type | Description |
|---|---|---|
time | *SystemTime | receives the reading |
GetTickCount64
pub extern func GetTickCount64() -> uint64
Retrieves the number of milliseconds that have elapsed since the system was started.
See also: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64
Returns: milliseconds since the system started