|
On Mon, 15 Aug 2011, Peter Harris wrote:
On Mon, Aug 15, 2011 at 4:57 PM, Luiz Henrique de Figueiredo wrote:Why not simply call usleep with t*1e6 ?Because POSIX allows usleep to return EINVAL if the argument is >= 1e6, and some OSs are silly enough to actually enforce this limit (eg. HP-UX).
The joys of POSIX. Alternatives are:'nanosleep', which takes a 'struct timespec' as an argument, so the delay is split up in seconds and nanoseconds.
'select', using NULL pointers for all the file descriptor sets, and a 'struct timeval' to specify the delay, which splits the delay into seconds and microseconds.
Gé