It doesn't work on Windows (Win7 x64 / Strawberry Perl 5.18.1 MSWin32-x64-multi-thread).

VinsWorldcom@C:\Users\VinsWorldcom\tmp> client.pl Time::HiRes::clock(): unimplemented in this platform at C:\Users\VinsW +orldcom\tmp\client.pl line 6. BEGIN failed--compilation aborted at C:\Users\VinsWorldcom\tmp\client. +pl line 6.

According to Re: Script execution time, you can use POSIX to get similar functionality on Windows. In client.pl, I added:

#use Time::HiRes qw( time gettimeofday clock ); use Time::HiRes qw( time gettimeofday ); use POSIX qw(CLOCKS_PER_SEC);

and updated the following lines:

# my $clock_t0 = clock(); my ($clock_t0, $clock_t1); (undef, undef, $clock_t0, undef, undef) = POSIX::times(); ... # my $clock_t1 = clock(); (undef, undef, $clock_t1, undef, undef) = POSIX::times();

... and it worked. Not sure if the "intent" is the same.

I don't see an SNTP module on CPAN. Have you considered make the code a module "Net::SNTP" and including the client and server as bin/ scripts?


In reply to Re: UDP SNTP Client/Server RFC by VinsWorldcom
in thread UDP SNTP Client/Server RFC by thanos1983

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.