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

Hello Monks,

I just came across with GetTimeSysInfoFunc. This function is written for C++ in WindowsOS.

Does anybody know any similar module or function for Perl, WindowsOS or LinuxOS?

I want to retrieve all the interesting information that the function can provide.

This is a long shot question, but just in case that someone knows something it would be great.

Thanks in advance for your time and effort reading and replying to my question.

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

Replies are listed 'Best First'.
Re: GetTimeSysInfoFunc function
by syphilis (Archbishop) on Jul 28, 2015 at 00:50 UTC
    You could use Inline::CPP to access the function.
    Some of those options are 64-bit integers, so it's best if you use a perl such that perl -V:ivsize outputs 8.

    The function is also available to mingw and ms C compilers (via timeprov.h). You can therefore alternatively access it using Inlne::C if, like me, you're uncomfortable with C++.

    A third alternative is to access it via the Win32::API module. (I assume this is possible, but I'm not at all adept at using that module.)

    Cheers,
    Rob

      Hello syphilis,

      The modules that you proposed look promising. Thank you for your time and effort I will try to play around with them. :D

      Seeking for Perl wisdom...on the process of learning...not there...yet!
        The modules that you proposed look promising.

        To avoid confusion: Most modules in the Win32::* namespace work only on Windows, they will not be aren't available on other platforms like Linux, MacOS or the BSDs. The only exception from this rule seems to be Win32::Autoglob, which can be used on any operating system, but does nothing on non-Windows systems.

        Alexander

        --
        Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Re: GetTimeSysInfoFunc function
by marinersk (Priest) on Jul 27, 2015 at 22:58 UTC

    Let's see.

    Start Here

    Results are less than voluminous, but under "Searches related to GetTimeSysInfoFunc Perl" we find perl get time in milliseconds, which seems reasonably related.

    And then there's lots of references to Time::HiRes, and a note that says it's been part of core (i.e., you shouldn't have to install it as it should already be there) since Perl 5.7.3.

    Apologies if Time::HiResis not what you were seeking; it seems fairly related to my quick skim of your question.

    It does look like GetTimeSysInfoFuncprovides a metric ton of options; and if that's what you were after -- maybe it's time to write a module that investigates ways to provide all the stuff GetTimeSysInfoFuncprovides.

    Assuming you are not restricted from doing so.

      Hello marinersk,

      Well I have been implementing a module that it does all that for LinuxOS but I can not find a way to do it on WindowsOS.

      Yesterday I post this question How to check system's current NTP configuration on all OS?. What I found is that I can retrieve all this information on LinuxOS but WindowsOS requires Administrator access to retrieve this information.

      I have been playing around with Time::HiRes but to be honest I can not get all the information that I want or at least it looks like this. I mean for example when I am applying

      ( undef , undef , $server_precision , undef , undef ) = POSIX +::times();
      the $server_precision prints 0 but in reality it is around -23.

      So this is why I was asking for a possible module that collects these values from WindowsOS but it seems with out administrator access you can not do anything. :(

      Well any way, thank you for your time and effort reading and replying to my question.

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

        Ah, good efforts, and my apologies for jumping to the conclusion that you hadn't done your homework. You actually did more than I had done, so I humbly retreat to my corner.

        For what it's worth, I see value in what you are doing, but it's never been needed enough in my world to motivate me to put the effort in that you are.

        All the best in your hunt -- Windows is an oddity amongst operating systems (it took me a long time to even acknowledge that it was one).

        Good luck in the hunt -- and I mean that earnestly.