From 0d122b247bff33a9bf7c9132e1400d8afd2abcce Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Mon, 2 Jan 2017 23:00:30 +0100 Subject: [PATCH] add a simple tool for formatting a timestamp in ns --- tools/development/timestamp.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100755 tools/development/timestamp.pl diff --git a/tools/development/timestamp.pl b/tools/development/timestamp.pl new file mode 100755 index 000000000..5edc635f4 --- /dev/null +++ b/tools/development/timestamp.pl @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +my $timestamp = shift(@ARGV); +$timestamp *= shift(@ARGV) if @ARGV; + +printf "%02d:%02d:%02d.%09d\n", + int($timestamp / 60 / 60 / 1000000000), + int($timestamp / 60 / 1000000000) % 60, + int($timestamp / 1000000000) % 60, + $timestamp % 1000000000;