That works good. :) My clock was about 10 minutes off.
Michael Smith said these things on 20000801.0927:
| Take the following script, put it in /sbin and set up a chron job to fun
| this every day at 0600 or 1800 or ??.
|
| -Mike
|
|
| #!/usr/bin/perl
| #Get the time from a time server
| #Marcel Gagne, Salmar Consulting Inc., 1999
| $remote_host="165.227.1.1";
| $remote_port="13";
| $hostname=`hostname`;
| chomp $hostname;
| use IO::Socket;
| $socket = IO::Socket::INET->new(
| PeerAddr => $remote_host,
| PeerPort => $remote_port,
| Proto => "tcp",
| Type => SOCK_STREAM)
| or die "Could not connect to " .
| "$remote_host:$remote_port; $@\n";
| #Get the time
| $the_time = <$socket>;
| print "\n\nThe Time is $the_time\n";
| $local_time = `date`;
| print "Your system, $hostname, thinks the " .
| "correct \ndate and time is $local_time\n";
| print "Resetting date and time... \n";
| $new_date = `date -s "$the_time"`;
| print "New date is $new_date\n\n";
| #Close the socket connection if open
| close ($socket);