in reply to Perl reading clock changes

You can compare the "system up time" vs. the "time of day" at two different points and see either that the system was rebooted in between or how much the time-of-day clock was adjusted during that period:

use Win32; my $bootTime= time() - Win32::GetTickCount()/1000;
$bootTime will be the time that the system booted based on the current setting of the time-of-day clock. If it varies by much more than 1.0, then the time has probably been adjusted.

But it sounds like a better solution is to have something interact with an external system that few people have access to adjust the time-of-day clock on.

You can also use "net time \\lazy-bum" from some other computer to see what the time-of-day clock is currently set to on the lazy-bum computer.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Perl reading clock changes
by Anonymous Monk on Feb 07, 2002 at 07:32 UTC
    We can get the startup time? not the elapsed time Because if we know the time that the computer startup, we can compare this to know if the clock was adjusted. For examples:
    A = Real time -> time()
    B = elapsed time -> GetTickCount()
    C = Teorical startup time

    A = 1:45pm
    B = 10 minutes
    C = 1:35pm

    C = A - B
    but we can't probe this because we don't know the real startup time. But if

    D = Real startup time
    D = 12:00pm
    We can compute if C = D
    if C = D the clock is correct
    if C <> D the clock was adjusted

    C = 1:35pm
    D = 12:00pm

    C <> D so the clock was adjusted

    BUT WE CAN TO KNOW THE STARTUP TIME???

      As I said, you compare two different values of the (computed) start-up time (based on the setting of the real-time clock at the time of your measurements). So you'll have to store (at least one of) your previous measurements somewhere for comparison.

              - tye (but my friends call me "Tye")