If your primary goal is to avoid drift, then this routine will do the trick (within the limitations of the system clock):
| | | $|= 1;
my $i;
my $start_time = time;
my $period = 60;
while (1) {
print time, "\n";
my $next_sleep = ($start_time + $period * ++$i) - time;
sleep $next_sleep;
}
|
This guarantees that future samples won't compound the timming imprecisions of prior samples.
MeowChow
s aamecha.s a..a\u$&owag.print