in reply to Re^3: Waiting for Alarm
in thread Waiting for Alarm
Need more accurate still? Then sleep for 1/100th of a second. It will still consume very little cpu and be another order of magnitude more accurate.
For example, if you want to call a routine every 10 seconds at a resolution of 1/100th of a second, then you could first sleep for 8 seconds, then for 0.2 seconds until within 0.2 sec, then for 0.01 seconds. (These are arbitrary values, of course.)
This could be premature optimization, though. :-)