jdhedden has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; use Time::HiRes; while (1) { print("Core : ", scalar localtime(), "\n"); print("HiRes: ", scalar localtime(Time::HiRes::time), "\n\n"); sleep(60); }
Update:I found the source of the problem.
PCs are terrible time keepers. It seems that under heavy load, the clock can continually loose time. On my laptop, I run an NTP client every 5 minutes to compensate for this. Doing so then causes problems with Time::HiRes. Whereas Perl's core time() function picks up on the NTP clock adjustments, Time::HiRes::time() does not.
You can see this by running the script above with sleep(10). Then adjust your PC's clock. You'll see that the 'Core' time picks up the adjustment, but the HiRes time does not.
Whether this constitutes a bug in Time::HiRes or not is a question.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Time::HiRes::time() Bug on Cygwin
by Limbic~Region (Chancellor) on Apr 03, 2004 at 14:13 UTC | |
by jdhedden (Deacon) on Apr 04, 2004 at 15:41 UTC |