diff options
| author | Andre Weissflog <floooh@gmail.com> | 2017-11-28 19:53:48 +0100 |
|---|---|---|
| committer | Andre Weissflog <floooh@gmail.com> | 2017-11-28 19:53:48 +0100 |
| commit | a2e2483940fcec4ee20f71b1daa43bae664a7d1d (patch) | |
| tree | 9ef4f1b10209c9f0a7d951113a96c57296db3c48 /sokol_time.h | |
| parent | 7c3bf97ef1609a9c8f948eba23dc833145c4bce8 (diff) | |
sokol_time: improved the header documentation a bit
Diffstat (limited to 'sokol_time.h')
| -rw-r--r-- | sokol_time.h | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/sokol_time.h b/sokol_time.h index ea80ca03..1de75117 100644 --- a/sokol_time.h +++ b/sokol_time.h @@ -15,9 +15,10 @@ (this calls for instance QueryPerformanceFrequency on Windows) uint64_t stm_now(); - Get current point in time in unspecified ticks. The value that - is returned has no relation to some absolute time or time unit, - it is only useful to compute time differences. + Get current point in time in unspecified 'ticks'. The value that + is returned has no relation to the 'wall-clock' time and is + not in a specified time unit, it is only useful to compute + time differences. uint64_t stm_diff(uint64_t new, uint64_t old); Computes the time difference between new and old. This will always @@ -28,15 +29,21 @@ (this is a shortcut for "stm_diff(stm_now(), start)") uint64_t stm_laptime(uint64_t* last_time); - Takes the current time, returns the time since last_time, - and stores current time in last_time. If last_time is 0, the - return value will be 0! + This is useful for measuring frame time and other recurring + events. It takes the current time, returns the time difference + to the value in last_time, and stores the current time in + last_time for the next call. If the value in last_time is 0, + the return value will be zero (this usually happens on the + very first call). + + Use the following functions to convert a duration in ticks into + useful time units: double stm_sec(uint64_t ticks); double stm_ms(uint64_t ticks); double stm_us(uint64_t ticks); double stm_ns(uint64_t ticks); - Convert a tick value into seconds, milliseconds, microseconds + Converts a tick value into seconds, milliseconds, microseconds or nanoseconds. Note that not all platforms will have nanosecond or even microsecond precision. |