On 4/1/2007 1:52 PM, Vahid Moghaddasi wrote:
> I am trying to separate the log entries, based on the date and time
> but I have difficulties identifying the time stamp without piping the
> logs to tai64nlocal utility.
TAI64N is documented at http://cr.yp.to/daemontools/tai64n.html
It's going to be hard to convert just by eye :). Are you trying to do
this in some scripting language?
> Is there a way to find out a given date and time e.g. 2007-04-01
> 13:40:46.790878500 in TAI format? This date in TAI is:
> "@40000000460feea82f23d924" in qmail/current file.
here's some perl that may help:
#!/usr/local/bin/perl
use strict;
my $ts = '@40000000460feea82f23d924';
$ts =~ /([a-f0-9]{8})([a-f0-9]{8})$/;
my ($ws,$fs) = (hex($1),hex($2));
my($sec,$min,$hour,$mday,$mon,$year) = (localtime($ws))[0,1,2,3,4,5];
$year += 1900;
$mon++;
my $date = sprintf("%04d-%02d-%02d %02d:%02d:%02d.%09d", $year, $mon,
$mday, $hour, $min, $sec, $fs);
print "date: $date\n";
__END__
--
Jeremy Kister
http://jeremy.kister.net./
|