RE: Perl question... calculating difference in time..

2002-12-05 Thread Jeff MacDonald
look into the perl module Date::Calc,
it's has ALOT of features that are quite useful for date manipulation.

jeff.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Eric Six
 Sent: Thursday, December 05, 2002 1:44 PM
 To: '[EMAIL PROTECTED]'
 Subject: Perl question... calculating difference in time..
 
 
 I know this isn't a perl list, but this is a perl on freebsd question! ;)
 
 I have a script that is sorting log files. I want to calculate the total
 time between log entrys. Here is the format of the log files:
 
 Dec 05 09:51:48.452 info info.info data
 ...
 Dec 05 09:53:49.543 info info.info data
 
 The output should return something along the lines of: total time between
 log entries 02:01:01.091.
 
 I have the time fields pulled out but I cannot figure out how to seprate
 them into a calculatable format. And if this was run from after 
 midnight and
 the log files rolled back to 23:00, how to calculate this..Any 
 help is much
 appreciated!
 
 TIA
 Eric
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message
 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message



Re: Perl question... calculating difference in time..

2002-12-05 Thread Matthew Seaman
On Thu, Dec 05, 2002 at 02:00:20PM -0500, Jeff MacDonald wrote:
 look into the perl module Date::Calc,
 it's has ALOT of features that are quite useful for date manipulation.

The Time::ParseDate module by David Muir Sharnoff looks just the
ticket.

http://search.cpan.org/author/MUIR/Time-modules-2002.1001/lib/Time/ParseDate.pm

It essentially does the reverse of strftime(3) --- and once you've got
the time expressed as seconds since the epoch, the rest of the
calculations required should be easy.

It's available in ports as part of devel/p5-Time.

Cheers,

Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.   26 The Paddocks
  Savill Way
  Marlow
Tel: +44 1628 476614  Bucks., SL7 1TH UK

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message