in reply to Parsing timestamps

Thanks for all of your input. Here is the code snipped I used:
# Timestamp 12 hours ago my $twelve_hours_ago = strftime("%Y-%m-%d/%H:%M:%S", (localtime(time-$ +hours*3600))); # Logfile may have been rotated during the past 12 hours. Thus we mus +t open # any logfile that is less than 12 hours old. find(\&wanted, "$logfile"); sub wanted { # Open loge file if it is less than 12 hours old and the # correct file name if ( (stat $_)[9] > time() - (3600 * $hours) && m/^log_file/ ) { # Debugging lines #print "file: ".$_."\n"; #my $stat = (stat $_)[9]; #print "stat: ".$stat."\n"; #my $twelve = time() - (3600 * $hours); #print "twelve: ".$twelve."\n"; # End of debugging lines. open LF, ($_) || die "Cannot open $logfile $!"; while (<LF>){ # Check for PASS log entry next unless (m/log :Monitor: CALLER Status \*PASS\*/); # Check timestamp $date = $1 if (m/^([^.]+)/); # Grab the date up to secon +ds next unless $date gt $twelve_hours_ago; #print "date: ".$date."\n"; # For debugging. # Count number for passes. $passcount++; # Save log line push @passlogs, $_; } } }

Neil Watson
watson-wilson.ca