I have two questions. 1. If the NTP server is not reachable then it exits the script and i never get any error message as such. Can i add error handling here ? 2. If the way i am trying to get time the right way ? i.e "Reference Timestamp" ? Thanks#!/bin/perl -w use strict; use warnings; use Net::NTP; my $ntp = '0.au.ntp.pool.org'; my $port = '123'; sub syncNTP{ my %result = get_ntp_response($ntp,$port); my $time = $result{'Reference Timestamp'}; my $newtime = localtime($time); return $newtime; }
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |