Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

elapsed time in milliseconds

Status
Not open for further replies.

imad77

Instructor
Oct 18, 2008
97
CA
Hi,

I need to get the elapsed time in milliseconds after running some commands.

I tried that but I get seconds:


Have you any suggestion?

thanks
=============
#!/usr/bin/perl
use Time::Local;

$start = time;

commands;

$elapsed = time - $start;
print "Time elapsed: $elapsed\n";
 
Oh great thanks, I installed this package or library and it works fine.

Here is what I tried and works fine for other people in the future:
===========
#!/usr/bin/perl
use Time::HiRes qw[gettimeofday tv_interval];

my $time1=[gettimeofday()];

commands;

my $milliseconds = tv_interval($time1)*1000;



printf "Elapsed time: %d milliseconds\n", $milliseconds;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top