in reply to Re: missing second of time
in thread missing second of time
Nice. Here's a way using select(), so that there's no need for non-core modules (ie. Time::Hires):
use strict; use warnings; my $fudgefactor = 0.01; while (1) { my $nextsecond = int time + 1; select(undef, undef, undef, $nextsecond - time - $fudgefactor); 1 while time < $nextsecond; printf "%.6f\n", time; }
Output:
1579973997.000000 1579973998.000000 1579973999.000000 1579974000.000000 1579974001.000000 ^C
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: missing second of time
by davido (Cardinal) on Jan 25, 2020 at 22:53 UTC |