Perl Time Sync Script
Perl runs deep in the infrastructure of the internet. If you are maintaining legacy backend scripts, use `LWP::UserAgent` to query our API for accurate timestamps and logging data.
PERL
use LWP::UserAgent;
use JSON;
use strict;
use warnings;
my $ua = LWP::UserAgent->new;
my $url = 'https://time.now/developer/api/timezone/Asia/Seoul';
my $response = $ua->get($url);
if ($response->is_success) {
my $data = decode_json($response->decoded_content);
print "Seoul Time: " . $data->{'datetime'} . "
";
print "Unix Epoch: " . $data->{'unixtime'} . "
";
} else {
die $response->status_line;
}
Why use Time.Now for SysAdmin?
- Installed on most Linux servers
- Powerful text processing
- Legacy compatible