Take a look at this: import std.stdio; import core.thread;
void main() { foreach (x; 0 .. 1000) { Thread.sleep(dur!("usecs")(999)); writeln(x); } foreach (x; 0 .. 1000) { Thread.sleep(dur!("usecs")(1000)); writeln(x); } } Compile and run it. The first foreach loop ends in an instant, while the second one takes much much longer to finish, which is puzzling since I've only increased the sleep while for a single microsecond. What's going on?