diff options
Diffstat (limited to 'Spear/Sys/Timer/timer.c')
-rw-r--r-- | Spear/Sys/Timer/timer.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Spear/Sys/Timer/timer.c b/Spear/Sys/Timer/timer.c index 707cd63..4a2fb2b 100644 --- a/Spear/Sys/Timer/timer.c +++ b/Spear/Sys/Timer/timer.c | |||
@@ -87,6 +87,15 @@ uint64_t time_point_to_ns(time_point* t) { | |||
87 | #endif | 87 | #endif |
88 | } | 88 | } |
89 | 89 | ||
90 | void time_add(const time_point* t, time_delta dt, time_point* out) { | ||
91 | #ifdef _WIN32 | ||
92 | *out = *t + dt; | ||
93 | #else | ||
94 | out->tv_sec = t->tv_sec + (dt / nanoseconds); | ||
95 | out->tv_nsec = t->tv_nsec + (dt % nanoseconds); | ||
96 | #endif | ||
97 | } | ||
98 | |||
90 | void time_sleep(time_delta dt) { | 99 | void time_sleep(time_delta dt) { |
91 | #ifdef _WIN32 | 100 | #ifdef _WIN32 |
92 | const int64_t ms = dt / microseconds; | 101 | const int64_t ms = dt / microseconds; |