Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sleep() on win32

Status
Not open for further replies.

marsd

IS-IT--Management
Apr 25, 2001
2,218
US
I needed a sleep function for win32 and was unwilling to
install cygwin.
I ended up using timeGetTime() and comparing to
a base timeGetTime() value + argv[1] * 1000 at program start.
The program works with an offset of 5-10ms, but the
cpu usage is , as expected, horrible.
Is there a better, more sophisticated way of doing
this on win32?
I'm using lcc, so some libs and header files are
not readily available.
 
Hi,
link with oldnames.lib and you should be able to resolve

sleep(x)

which really goes to

_Sleep(x)

where x is in milliseconds so you need to multiply by 1000 if you want to sleep in seconds.


-----
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top