I have a task to do something every \"round\" minute(at xx:xx:00) And I use something like
const int statisticsInterval=60;
time_t t=0;
while (1)
In general, Sleep is not the correct method for timing of anything. Better to use a precision timer with a callback function. On Windows, one may use the "Multimedia" timers, which have a resolution no greater than 1 ms on most hardware. see here. When the timer expires, the OS calls callback function in close to real time. see here.