Tim Gessner
|
problems timing using usleep
|
Tim Gessner
10/16/2008 11:48 AM
post15095
|
problems timing using usleep
I am trying to time a loop. I want to sleep some so that I am not just spinning and waiting. The timeout can be
lengthy, 40 to 50 seconds.
I can't use clock() and usleep() as the latter affects the former (which makes sense I guess, but not what I expected).
I have tried to use clock_gettime() and to use nanosecond math. That requires large ints and uint64, et. Al. don't seem
to accept anything larger than a 32 bit value.
I could do a more complex comparison using timespecs without the nanosecond math, but it seems like I'm fighting one
problem after another.
Am I on the right track at all? What is the best way to timeout a loop and still include some type of sleep so that I'm
not constantly spinning?
Thanx
Tim
|
|
|