At 12:54 PM 9/17/02 -0700, you wrote: >Steve wrote: > > > I have this snippet of code which works fine. $start_time has MM-DD-YYYY > > HH:MM:SS.MM which is what I want. > > > > ################################# > > > > if ($line =~ /^(\d\d-\d\d-\d{4}\s+\d\d:\d\d:\d\d\.\d\d).+Connection > > Established.+(\d\d\d\d\d)/i) { > > $start_time = $1; > > printf ("Start Time: $start_time\n"); > > > > } > > ################################ > > > > > > ################################ > > if ($line =~ /^(\d\d-\d\d-\d{4})\s+(\d\d:\d\d:\d\d\.\d\d).+Session > >$1 doesn't include the time. it only has the date! you aren't using your $2 >below...
Oops, that if should be which is still giving me the error: if ($line =~ /^(\d\d-\d\d-\d{4}\s+\d\d:\d\d:\d\d\.\d\d).+Session > > Statistics/i) > > { > > $end_time = $1; > > printf ("End Time: $end_time\n"); > > } > > ################################ > > > > > >looks like you are using Date::Manip for your time/date manipulation: > >#!/usr/bin/perl -w >use strict; >use Date::Manip; > >my $i = "09-17-2002 11:34:21.09 - Connection established at 898bps.\n"; >my $j = "09-17-2002 11:40:46.57 - Session Statictics: blablabla\n"; > >#-- you probably don't need the '?' >my($s_time) = $i =~ >/^(\d{2}-\d{2}-\d{4}\s+\d{2}:\d{2}:\d{2}\.\d{2}).+?Connection established >at/i; > >#-- again you can probably get away without '?' >my($e_time) = $j =~ >/^(\d{2}-\d{2}-\d{4}\s+\d{2}:\d{2}:\d{2}\.\d{2}).+?Session Statictics:/i; > >$s_time =~ s#-#/#g; >$e_time =~ s#-#/#g; > >$s_time = ParseDate($s_time); >$e_time = ParseDate($e_time); > >my $error; >my $diff = DateCalc($s_time,$e_time,\$error,1); > >die "Error comparing: $s_time and $e_time\n" if($error); > >print "$diff\n"; > >__END__ > >david That still out puts the same error and the same date/time string of: +0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0 :0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0 :0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0 :0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0 :0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0:0:0:0:0:0:0+0 :0:0:0:0:0:0+0:0:0:0 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]