in reply to SNTP Client/Server V2 RFC

Again, like in Re: UDP SNTP Client/Server RFC, it doesn't work on Windows, this time due to 'clock_getres'. The quick fix in client:

use Time::HiRes qw( gettimeofday CLOCK_REALTIME); #clock_getres ); # my $precision_client = clock_getres( CLOCK_REALTIME ); use POSIX qw(CLOCKS_PER_SEC); my (undef, undef, $precision_client, undef, undef) = POSIX::times();

And the same in the server changing the variable to $precision_server.

Replies are listed 'Best First'.
Re^2: SNTP Client/Server V2 RFC
by thanos1983 (Parson) on Sep 23, 2014 at 22:27 UTC

    Hello VinsWorldcom,

    You are right, I completely forgot about it. I am updating the code with the new version now.

    One last question, do you get an error message if you have in your code this part: use Time::HiRes qw( gettimeofday CLOCK_REALTIME clock_getres );, or you get the error when you execute the code?

    Thanks again for your time and effort.

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

      Yes, it fails "compilation" immediately:

      VinsWorldcom@C:\Users\VinsWorldcom\tmp> client.pl Time::HiRes::clock_getres(): unimplemented in this platform at C:\User +s\VinsWorldcom\tmp\test.pl line 6. BEGIN failed--compilation aborted at C:\Users\VinsWorldcom\tmp\test.pl + line 6. VinsWorldcom@C:\Users\VinsWorldcom\tmp> ver Microsoft Windows [Version 6.1.7601] VinsWorldcom@C:\Users\VinsWorldcom\tmp> which perl C:\strawberry\perl\bin\perl.exe VinsWorldcom@C:\Users\VinsWorldcom\tmp> perl -v This is perl 5, version 18, subversion 1 (v5.18.1) built for MSWin32-x +64-multi-thread [...]

        Hello VinsWorldcom,

        Your feedback is very valuable to me, I just updated the code now, and removed the clock_getres that was producing the problem.

        Both scripts are operating with my (undef, undef, $precision_client, undef, undef) = POSIX::times(); but the precision it seems not correct.

        Apart from that I am working again on small other improvements that I have in my mind. I will post the updated version as soon as I finish it.

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