Skip to content

Instantly share code, notes, and snippets.

@indrayam
Created May 26, 2016 20:32
Show Gist options
  • Save indrayam/d588071022d2fb982f19cf674ca4d3d3 to your computer and use it in GitHub Desktop.
Save indrayam/d588071022d2fb982f19cf674ca4d3d3 to your computer and use it in GitHub Desktop.
Convert nanoseconds (as in InfluxDB measurements) into human readable date/timestamp
#!/usr/bin/perl -w
#
$num_of_args = $#ARGV + 1;
if ($num_of_args != 1) {
print "Usage: ns2date.pl <epochtime in nanoseconds>\n";
exit;
}
$ns = $ARGV[0];
print scalar localtime($ns / 1000000000) . "\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment