I can't find any timers in phobos, basically I want some loop to run for a 
predetermined amount of time. Currently I use this:

import core.time;
import std.datetime;
import core.thread;

void main()
{
    auto finalTime = Clock.currTime + dur!"seconds"(4);
    
    while (true)
    {
        Thread.sleep(dur!("seconds")(1));
        if (Clock.currTime > finalTime)
            break;   
    }
}

Is that check doing any conversions in the background, or am I safe 
(performance-wise)? Well I'm probably wasting performance on waking up the 
thread every second.. hmm.

Reply via email to