Re: Timestamp in the trace files

From: Mladen Gogala <no_at_email.here.invalid>
Date: Wed, 6 Jan 2010 21:48:46 +0000 (UTC)
Message-ID: <pan.2010.01.06.21.48.46_at_email.here.invalid>



On Wed, 06 Jan 2010 21:10:56 +0100, Maxim Demenko wrote:

> Sorry, of course, i am interpreting your words like it better suit my
> needs ;-)
> But either your meant to say "The application has run on 05-Jan-2010" -
> in that case my previous post still applies, or it run indeed on
> 05-Jan-2009 and my math is wrong, but then it is unclear with "The
> result is January 28th, 2009, which is almost a year off".
>
>
> Best regards
>
> Maxim

Maxim, you helped me a lot! It works now. Here is the result, written in The algorithm is yours, I just had to apply it properly. Thanks again for your help. I must be getting senile these days.

#!/usr/bin/perl -w
use strict;
sub cnv_tim($);

sub cnv_tim($) {

    my $A = shift;
    my ( $sec, $min, $hr, $dd, $mm, $yr ) =       localtime( ( $A * 1024 ) / 1000000000 );     $yr += 1900;
    $mm++;
    my $str = sprintf( "%d-%d-%d %d:%d:%d\n", $yr, $mm, $dd, $hr, $min, $sec );

    return ($str);
}
map { print "tim=$_ --> ", cnv_tim($_); } _at_ARGV;

Here is how to run it:

mgogala_at_nycwxp2622:/tmp$ ./ttt 1233122413959653 tim=1233122413959653 --> 2010-1-5 13:49:11                 

You can put as many "tim" timestamps on the command line as necessary, the script will convert them all, one line per timestamp. Some people object to my function declarations but I used to program in C and have carried over some habits.

-- 
http://mgogala.byethost5.com
Received on Wed Jan 06 2010 - 15:48:46 CST

Original text of this message