Use something like clock() or GetTickCount() or, more precise, timeGetTime().
Just take a value when you begin and then take one value when you stop and subtract and you have the time it took to execute.
This is a discussion on Sleep(); within the Windows Programming forums, part of the Platform Specific Boards category; Use something like clock() or GetTickCount() or, more precise, timeGetTime(). Just take a value when you begin and then take ...
Code:[Linker error] undefined reference to `timeGetTime@0'
Last edited by HelpLol; 02-17-2008 at 08:33 PM.
oh thanks. Got it working.
> Sleep can also sleep less than the specified interval in some cases. But it sleeps roughly the amount of time specified by the code. And of course you can pass a variable with the time to the function.
Cool, very helpful -- I always thought Sleep() was guaranteed to sleep for at least n seconds. Apparently not.