thanos1983 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

I am looking for a function that can provide me the last update time of the hardware clock on Windows/Linux OS through Perl.

Update: The last update time that the OS was synchronized with a time server.

I have been looking over the web and I can not find something similar. I can find modules to play around with the hardware clock such as Test::MockTime or Time::Mock but they are not suitable from my request.

I want a function that will reply back with the epoc seconds since the last update time. For example since last update time of hardware clock was 5.7 sec.

Thank you in advance for your time and effort.

Seeking for Perl wisdom...on the process of learning...not there...yet!

Replies are listed 'Best First'.
Re: last update time of hardware clock (Windows and Linux)
by BrowserUk (Patriarch) on Sep 21, 2014 at 22:25 UTC
    I am looking for a function that can provide me the last update time of the hardware clock ...

    What do you mean by the "last update time"?

    Do you mean:

    • the last time it was manually adjusted?
    • the last time it was synchronised with a time server?
    • the last time it was incremented by the hardware interrupt?

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Hello BrowserUk,

      You are absolutely right. This is very important details that I did not mention it. I am looking for the last time it was synchronized with a time from the server.

      I am updating the question to avoid future confusion.

      Seeking for Perl wisdom...on the process of learning...not there...yet!
        I am looking for the last time it was synchronized with a time from the server.

        On windows, you can parse the output of: w32tm /query /status. It is the 7th line of 9.

        The info is probably in the registry somewhere, but a quick search of ms.com didn't turn up the relevant key.


        With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.
Re: last update time of hardware clock (Windows and Linux) with the Server
by karlgoethebier (Abbot) on Sep 22, 2014 at 12:19 UTC

      Hello karlgoethebier,

      This looks like what I needed, thanks a lot for your time and effort.

      Seeking for Perl wisdom...on the process of learning...not there...yet!
        "...looks like what I needed..."

        But just out of curiosity: what is it good for?

        Update: Oops! Sorry, i replied to the wrong thread! Sorry!

        Best regards, Karl

        «The Crux of the Biscuit is the Apostrophe»