From eea524f1060a2fd05e17652efefc1235e014bcfd Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 23 Jun 2020 16:55:02 -0400 Subject: [PATCH] jtk.timer: store times in microseconds, not milliseconds --- src/jtk/timer.d | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/jtk/timer.d b/src/jtk/timer.d index 14085ac..f93afd4 100644 --- a/src/jtk/timer.d +++ b/src/jtk/timer.d @@ -15,9 +15,9 @@ class Timer this(ulong delay, ulong interval, void * user) { - ulong current_time = ms_time(); - this.next = current_time + delay; - this.interval = interval; + ulong current_time = us_time(); + this.next = current_time + (delay * 1000u); + this.interval = interval * 1000u; this.user = user; timers[this] = this; } @@ -41,7 +41,7 @@ class Timer static Timer get_expired_timer() { - ulong current_time = ms_time(); + ulong current_time = us_time(); foreach (Timer timer; timers) { if (timer.next <= current_time) @@ -55,7 +55,7 @@ class Timer static ulong time_to_next_timer_expiration() { ulong rv = cast(ulong)-1; - ulong current_time = ms_time(); + ulong current_time = us_time(); foreach (Timer timer; timers) { if (timer.next <= current_time)