Epoch time conversion - Exactly what was needed...
Main Topics
Browse All TopicsI have a file that contains start and end times for processes:
Start BatPrcsDrvr.pl CAEXPENS 1 2009-05-05 01:05:52
End BatPrcsDrvr.pl CAEXPENS 1 Successfully 2009-05-05 01:05:53
Start BatPrtnDrop.pl CAEXPENS 1 2009-05-05 01:06:12
End BatPrtnDrop.pl CAEXPENS 1 Successfully 2009-05-05 01:15:29
Start BatBackup.pl CAEXPENS 1 2009-05-05 01:21:11
End BatBackup.pl CAEXPENS 1 Successfully 2009-05-05 01:25:57
etc.
I want to take the time stamp on the End line and compare it to the time stamp on the start line to get the elapsed time. I am working on this now but not getting very far so any tips would be appreciated. I will repost if I figure it out first.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
You can also use the CPAN, Date::Manip modules to manipulate date. This also handles text having dates.
See:
http://search.cpan.org/~sb
Although the Date:: Manip could probably also do what I needed - I took the first authors comments and created a function then imbedded this into my output as follows - this is in a while loop that does other stuff as well but thought I would show how I used the solution - thanks to both of you for your help.
print $fh_output_time_log ("$_", " ", &epoch_time($_) ," \n");
sub epoch_time
{
local @_;
@d=/(\d+)-(\d+)-(\d+)\s+(\
return(sprintf(timelocal(@
}
Business Accounts
Answer for Membership
by: ozoPosted on 2009-05-05 at 10:45:39ID: 24307147
use Time::Local; d+):(\d+): (\d+)/; ]-1,$d[0]) ;
$_='Start BatPrcsDrvr.pl CAEXPENS 1 2009-05-05 01:05:52';
@d=/(\d+)-(\d+)-(\d+)\s+(\
$timestamp = timelocal(@d[5,4,3,2],$d[1