gitweb: Time::HiRes is in core for Perl 5.8
We say 'use 5.008' at the beginning of the script, therefore there is no need to check if Time::HiRes module is available. We can also import gettimeofday and tv_interval. Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
6f10c4103d
commit
3962f1d756
@ -17,12 +17,10 @@ use Encode;
|
|||||||
use Fcntl ':mode';
|
use Fcntl ':mode';
|
||||||
use File::Find qw();
|
use File::Find qw();
|
||||||
use File::Basename qw(basename);
|
use File::Basename qw(basename);
|
||||||
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
binmode STDOUT, ':utf8';
|
binmode STDOUT, ':utf8';
|
||||||
|
|
||||||
our $t0;
|
our $t0 = [ gettimeofday() ];
|
||||||
if (eval { require Time::HiRes; 1; }) {
|
|
||||||
$t0 = [Time::HiRes::gettimeofday()];
|
|
||||||
}
|
|
||||||
our $number_of_git_cmds = 0;
|
our $number_of_git_cmds = 0;
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
@ -1065,7 +1063,7 @@ sub dispatch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub reset_timer {
|
sub reset_timer {
|
||||||
our $t0 = [Time::HiRes::gettimeofday()]
|
our $t0 = [ gettimeofday() ]
|
||||||
if defined $t0;
|
if defined $t0;
|
||||||
our $number_of_git_cmds = 0;
|
our $number_of_git_cmds = 0;
|
||||||
}
|
}
|
||||||
@ -3590,7 +3588,7 @@ sub git_footer_html {
|
|||||||
print "<div id=\"generating_info\">\n";
|
print "<div id=\"generating_info\">\n";
|
||||||
print 'This page took '.
|
print 'This page took '.
|
||||||
'<span id="generating_time" class="time_span">'.
|
'<span id="generating_time" class="time_span">'.
|
||||||
Time::HiRes::tv_interval($t0, [Time::HiRes::gettimeofday()]).
|
tv_interval($t0, [ gettimeofday() ]).
|
||||||
' seconds </span>'.
|
' seconds </span>'.
|
||||||
' and '.
|
' and '.
|
||||||
'<span id="generating_cmd">'.
|
'<span id="generating_cmd">'.
|
||||||
@ -5298,7 +5296,7 @@ sub git_blame_common {
|
|||||||
print 'END';
|
print 'END';
|
||||||
if (defined $t0 && gitweb_check_feature('timed')) {
|
if (defined $t0 && gitweb_check_feature('timed')) {
|
||||||
print ' '.
|
print ' '.
|
||||||
Time::HiRes::tv_interval($t0, [Time::HiRes::gettimeofday()]).
|
tv_interval($t0, [ gettimeofday() ]).
|
||||||
' '.$number_of_git_cmds;
|
' '.$number_of_git_cmds;
|
||||||
}
|
}
|
||||||
print "\n";
|
print "\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user