in reply to UDP SNTP Client/Server RFC
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: UDP SNTP Client/Server RFC
by thanos1983 (Parson) on Sep 16, 2014 at 10:35 UTC |