This is in reference to a previous post regarding interval timers
getting off track in the Event module.

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.

To see this, run the following test script.

#!/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(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.

Again, to keep this from affecting my application, I had to edit
Event.pm to not use Time::HiRes.  Is there another way to turn off
using Time::HiRes in Event?  If not, I'd like to request adding one.


Reply via email to