Time difference in seconds
There seems to be a convenient Date::Parse. Here's the example:
use Date::Parse;
print str2time ('Feb 3 12:03:20') . "\n";
And here's what it outputs:
$ perl test.pl
1328288600
which is:
Fri Feb 3 12:03:20 EST 2012
I'm not sure how decent the parsing is, but it parses your example just fine :)
In the spirit of TMTOWTDI, you can leverage the core Time::Piece :
#!/usr/bin/env perl
use strict;
use warnings;
use Time::Piece;
my $when = "@ARGV" or die "'Mon Day HH:MM:SS' expected\n";
my $year = (localtime)[5] + 1900;
my $t = Time::Piece->strptime( $year . q( ) . $when, "%Y %b %d %H:%M:%S" );
print "delta seconds = ", time() - $t->strftime("%s"),"\n";
$ ./mydelta Feb 3 12:03:20
delta seconds = 14553
The current year is assumed and taken from your localtime.
#!/usr/bin/perl
my $Start = time();
sleep 3;
my $End = time();
my $Diff = $End - $Start;
print "Start ".$Start."\n";
print "End ".$End."\n";
print "Diff ".$Diff."\n";
This is a simple way to find the time difference in seconds.