Re: time encoding

From: Alex Rousskov <rousskov@dont-contact.us>
Date: Thu, 10 Dec 1998 11:00:18 -0700 (MST)

On Thu, 10 Dec 1998, Mohammed Hamed wrote:

> Are there any scripts that can convert the time stamps in the access.log files to meaningful time values ?

Consider searching the archive. Similar question was asked before and several
people posted their scripts. Some of them were better than the one I re-post
below. My script will convert "anything" that looks like Squid timestamp into
a local time string.

N.B. Time stamps in access.log are meaningful time values.

Alex.

#!/usr/local/bin/perl -w

while (<STDIN>) {
    if (/^\d+$/) {
        printf("%d = %s\n", $_, scalar localtime($_));
    } else {
        while (/\b(\d{9})(?:\.\d\d\d)?\b/) {
            $_ = $` . scalar(localtime($1)) . $';
        }
        print($_);
    }
}
Received on Thu Dec 10 1998 - 11:15:47 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:43:36 MST