[Nottingham] Perl time difference in milliseconds

Graeme Fowler graeme at graemef.net
Thu May 11 20:05:05 BST 2006


Hi

On Thu, 2006-05-11 at 17:36 +0000, Phil Court wrote:
> 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

You need the Time::HiRes module:

Time::HiRes - High resolution alarm, sleep, gettimeofday, interval
timers

You may need to do some time conversions, but as long as you have those
numbers you'll be able to calculate the difference accurately.

Saying that, if you have the time in that format you should be able to
work it out fairly efficiently without any modules at all!

Graeme






More information about the Nottingham mailing list