Where is sleep()?

codephantom me at noyb.com
Sun Dec 17 09:36:18 UTC 2017


On Sunday, 17 December 2017 at 08:32:20 UTC, Ryan David Sheasby 
wrote:
> Hey guys. First time poster here. I've searched high and low 
> but can't seem to find a simple sleep/delay/wait/pause function 
> in the core or in phobos. The most recent information I can 
> find about it is this forum post from 12 years ago: 
> http://forum.dlang.org/thread/avr99b$b8j$2@digitaldaemon.com In 
> which they suggest using std.c.time which is now depreciated 
> and seems to have been replaced by core.stdc.time which doesn't 
> have any sleep functions... What am I missing?

// --------------

import std.stdio;
import core.thread;

void main()
{
     int waitTime = 5;

     writeln("Waiting ", waitTime, " seconds...");
     Thread.sleep(waitTime.seconds);
     writeln("Done waiting!");
}
// --------------



More information about the Digitalmars-d-learn mailing list