I know clock() does not give wall-clock time, and CLOCKS_PER_SEC is system dependent value. Let's say I dont care system dependent issues, can I assume below code always waits 1 second in both GNU/Linux and Windows, because I tested it seemed ok to me. Or should I stick with system dependent sleep()/usleep() functions?
void wait_a_sec()
{
clock_t start = clock();
do
{
// wait 1 sec
/**
* Second call to clock() gives the processor time in clock ticks
* since first call to it.
* CLOCKS_PER_SEC: clock ticks per sec.
*/
} while ( clock() < (start + CLOCKS_PER_SEC) );
}