in reply to Efficiently calculate the difference between TimeStamps in LOG

Well in looking at it, I'd say your time calcs are pretty good. Really throwing modules at that will only slow you down.

OTOH I'd probably not slurp the whole file just for this.

my ($min,$max); $min=$max=<LOG>; while (my $ts=<LOG>) { $min = ($min gt $ts) ? $ts : $min; $max = ($max lt $ts) ? $ts : $max; }

You can use the string order sorting to your advantage with that timestamp and not load the whole file into memory. Handy trick...

--
$you = new YOU;
honk() if $you->love(perl)

  • Comment on Re: Efficiently calculate the difference between TimeStamps in LOG
  • Download Code