in reply to Re^4: Pause Loop
in thread Pause Loop
It's just a case of interpretation as to whether the OPs "Every hour ... " translates into your "Every hour on the hour...". Only the OP will really be able to answer that.
There is also the consideration of what happens if the # do stuff takes longer than 1 hour occasionally. Is it more important that the next pass is executed 'on the hour', thereby causing one cycle to be missed. Or is it better to do it immediately? Again, the answer will depend upon the details of what's being done and why.
You did see the smiley?
Also, if you simply want to delay the iteration until the start of the next hour after the last cycle completes, your code could be simpler I think:
while (1) { # Do stuff here; sleep ( 3600 - time() % 3600 ); }
|
|---|