[Nottingham] Perl time difference in milliseconds

Duncan John Fyfe djf at star.le.ac.uk
Fri May 12 11:22:10 BST 2006


On Fri, 2006-05-12 at 07:55 +0100, Michael Erskine wrote:
> On Thursday 11 May 2006 18:36, Phil Court wrote:
> > Hi,
> > Does any one know how to compute time differences in perl ?
> >  
> > I.e.
> > Start time = 21:51:11.576
> > end   time = 21:52:09:123
> 
> Surely you mean "e.g." (meaning "for example") rather than "i.e." (meaning 
> "that is") otherwise the answer is always 1:57.547 :)
> 
> If you meant "e.g." then Time::HiRes is your module-de-jour.
> 
> BTW: please don't post in HTML

If you need to parse different date formats the datetime[1] modules
can be a good place to start. 
[1] http://search.cpan.org/~drolsky/DateTime-0.30/lib/DateTime.pm
    http://datetime.perl.org/ (appears to be dead atm).

They are also a good example a badly structured set of libraries
(eg. the HTTP Format date module does a better job of parsing ISO861
 dates than the ISO8601 Format module. ).

Have fun,
Duncan
-- 
Duncan John Fyfe <djf at star.le.ac.uk>




More information about the Nottingham mailing list