You're viewing old version number 1. - Current version
Perl Timer Code
http://stackoverflow.com/questions/656537/is-there-a-better-way-to-determine-elapsed-time-in-perl
http://www.perlmonks.org/?node_id=519091
3 different ways:
#!/usr/bin/perl -wT
use Time::HiRes;
use Time::HiRes qw( time );
my $start_time = [Time::HiRes::gettimeofday()];
my $start = Time::HiRes::gettimeofday();
my $start_a = time();
print "hey\n";
my $diff = Time::HiRes::tv_interval($start_time);
my $end = Time::HiRes::gettimeofday();
my $end_a = time();
print "diff 1 = $diff\n";
printf("diff 2 = %.6f\n", $end - $start);
printf("diff 3 = %.6f\n", $end_a - $start_a);
<a href="/cgi-bin/junco.pl/tag/programming">#programming</a> - <a href="/cgi-bin/junco.pl/tag/perl">#perl</a>
From JR's : articles
64 words - 672 chars
created on
- #
source
- versions
Related articles
Perl try, catch, eval, die, warn, carp - Jun 25, 2013
Perl Timer Code - Feb 11, 2015
Testing module to keep in mind - November 2002 - Jul 18, 2014
Loop through a Perl array - Oct 02, 2013
Perl Critic and Diag - Oct 09, 2013
more >>