in reply to Re: Re: Looping
in thread Looping
Really good! I like your approach! And I think that robobunny got the point: if getting the right time is critical, you can't rely on yourself.
Another solution would be to synchronize your server by means of the NTP protocol, which is the best way IMHO. I studied the principles of the protocol to implement a synchronization subnet for my job, and I was greatly surprised of how much statistical studies they put in; that makes NTP a higly-reliable protocol!
Even if you don't want to invest a little to install a NTP server on your machine, you could take a look at the list of stratum 2 NTP servers and check if at least one of them offers the service by means of the daytime protocol too. To check, you can telnet to the tcp port 13 (i.e.: do a telnet host 13) and check if you get an output like:
bronto@cooper:/tmp$ telnet myTimeServer 13 Trying 192.168.1.234... Connected to myTimeServer. Escape character is '^]'. Wed Jun 26 11:01:08 2002 Connection closed by foreign host.
If so, you can get the current year using just Perl and Net::Telnet!
Ciao!
--bronto
PS: if reading a document in italian language doesn't bother you, I can send a PDF doc I wrote about NTP and our synchronization subnet to anyone interested in. Just let me know!
# Another Perl edition of a song:
# The End, by The Beatles
END {
$you->take($love) eq $you->made($love) ;
}
|
|---|