Thanks for the lightbulb. I see no error since doing it that way. I wonder if the perldoc for sleep should add something like:
Explain why this is a subtle trap:
while () {
print something();
sleep 1 # WRONG!
}
Calculate the next second:
use Time::HiRes qw/sleep time/;
while () {
print something();
sleep do { (int time + 1) - time } # RIGHT!
}
Maybe it's already a FAQ? I don't know. Thank you!
In reply to Re^2: missing second of time
by Anonymous Monk
in thread missing second of time
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |