Try this one
#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11111868 use warnings; use Time::HiRes qw( time sleep ); my $fudgefactor = 0.001; while(1) { my $time = time; my $nextsecond = int $time + 1; my $interval = $nextsecond - $time - $fudgefactor; $interval > 0 and sleep $interval; 1 while time < $nextsecond; printf "%.6f\n", time; }
In reply to Re^4: missing second of time
by tybalt89
in thread missing second of time
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |