watch

This little Perl one-liner can get handy when you need to translate “time in seconds since the Epoch” (for example in logs) to local time :

% perl -e 'print scalar(localtime(1202484725)), "\n";'
Fri Feb  8 16:32:05 2008
%

This was pretty useful today when browsing through Nagios event logs, where times are given in seconds from the Epoch.

By the way, the Epoch is defined as 00:00 UTC on January, 1st, 1970.

March 6, 2008 at 9:07 pm by Stephane Kattoor
Category: Dev
Tags: , , , ,