Is there a better way to do this than with the system up time? (Is there an actual command in C++ to perform an action every x seconds?)Code:while(true)
{
if (system uptime % 5 == 0)
{
//do stuff
}
}
Printable View
Is there a better way to do this than with the system up time? (Is there an actual command in C++ to perform an action every x seconds?)Code:while(true)
{
if (system uptime % 5 == 0)
{
//do stuff
}
}
Most OS's have a sleep command (with various capitalizations) that allow your program to cede x amount of time to other processes and resume afterwards.