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
Creating Perl Modules and OO Programming - Oct 17, 2013
Scaup web publishing app update as of Feb 21, 2015 - Mar 02, 2015
Perl regex extracting domain name from URL code example - Oct 02, 2013
Rest and Json links to keep around - Oct 10, 2013
Installing a Perl Module - Jan 13, 2015
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Jan 8, 2025 - 9:04 a.m. EST