jtk.timer: store times in microseconds, not milliseconds
This commit is contained in:
parent
a811a743b8
commit
eea524f106
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user