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);

end code

#programming - #perl

From JR's : articles
64 words - 604 chars
created on
updated on - #
source - versions

Related articles
Perl code for string processing - Jul 06, 2013
Veery Blog App - April 2015 - Aug 03, 2015
Perl conditional loading modules - Oct 02, 2014
Quotes in Perl - Oct 12, 2013
Test Automation using Perl - May 17, 2013
more >>



A     A     A     A     A

© 2013-2017 JotHut - Online notebook

current date: Jan 7, 2025 - 9:57 a.m. EST