mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Update time.odin
Add caveats.
This commit is contained in:
@@ -214,6 +214,11 @@ time_add :: proc(t: Time, d: Duration) -> Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Accurate sleep borrowed from: https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
|
// Accurate sleep borrowed from: https://blat-blatnik.github.io/computerBear/making-accurate-sleep-function/
|
||||||
|
//
|
||||||
|
// Accuracy seems to be pretty good out of the box on Linux, to within around 4µs worst case.
|
||||||
|
// On Windows it depends but is comparable with regular sleep in the worst case.
|
||||||
|
// To get the same kind of accuracy as on Linux, have your program call `win32.time_begin_period(1)` to
|
||||||
|
// tell Windows to use a more accurate timer for your process.
|
||||||
accurate_sleep :: proc(d: Duration) {
|
accurate_sleep :: proc(d: Duration) {
|
||||||
to_sleep, estimate, mean, m2, count: Duration
|
to_sleep, estimate, mean, m2, count: Duration
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user