@matheusbsbs / matheus-bagliano / commits / 3962f1d756
Fork 0

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>

Jakub Narebski committed Nov 9, 2010 at 19:27 UTC 3962f1d756ab41c1d180e35483d1c8dffe51e0d1
1 file changed +5 -7
gitweb/gitweb.perl
+5 -7
@@ -17,12 +17,10 @@ use Encode;
17 use Fcntl ':mode';
18 use File::Find qw();
19 use File::Basename qw(basename);
20 +use Time::HiRes qw(gettimeofday tv_interval);
21 binmode STDOUT, ':utf8';
22
22 -our $t0;
23 -if (eval { require Time::HiRes; 1; }) {
24 - $t0 = [Time::HiRes::gettimeofday()];
25 -}
23 +our $t0 = [ gettimeofday() ];
24 our $number_of_git_cmds = 0;
25
26 BEGIN {
@@ -1065,7 +1063,7 @@ sub dispatch {
1063 }
1064
1065 sub reset_timer {
1068 - our $t0 = [Time::HiRes::gettimeofday()]
1066 + our $t0 = [ gettimeofday() ]
1067 if defined $t0;
1068 our $number_of_git_cmds = 0;
1069 }
@@ -3590,7 +3588,7 @@ sub git_footer_html {
3588 print "<div id=\"generating_info\">\n";
3589 print 'This page took '.
3590 '<span id="generating_time" class="time_span">'.
3593 - Time::HiRes::tv_interval($t0, [Time::HiRes::gettimeofday()]).
3591 + tv_interval($t0, [ gettimeofday() ]).
3592 ' seconds </span>'.
3593 ' and '.
3594 '<span id="generating_cmd">'.
@@ -5298,7 +5296,7 @@ sub git_blame_common {
5296 print 'END';
5297 if (defined $t0 && gitweb_check_feature('timed')) {
5298 print ' '.
5301 - Time::HiRes::tv_interval($t0, [Time::HiRes::gettimeofday()]).
5299 + tv_interval($t0, [ gettimeofday() ]).
5300 ' '.$number_of_git_cmds;
5301 }
5302 print "\n";