From dcaed00723aeec80bf78d2fa4ef4950aee3034c6 Mon Sep 17 00:00:00 2001 From: Leon Timmermans Date: Sat, 22 Mar 2025 18:32:37 +0100 Subject: [PATCH] Make Time::HiRes a mandatory dependency --- lib/App/Prove/State/Result/Test.pm | 3 +-- lib/TAP/Base.pm | 16 ++++------------ lib/TAP/Formatter/Base.pm | 2 +- lib/TAP/Harness.pm | 3 +-- lib/Test/Harness.pm | 6 ++---- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/lib/App/Prove/State/Result/Test.pm b/lib/App/Prove/State/Result/Test.pm index a8f6197b..d5c6620c 100644 --- a/lib/App/Prove/State/Result/Test.pm +++ b/lib/App/Prove/State/Result/Test.pm @@ -113,8 +113,7 @@ TODO passed). =head3 C -The total time it took for the test to run, in seconds. If C is -available, it will have finer granularity. +The total time it took for the test to run, in seconds. =head3 C diff --git a/lib/TAP/Base.pm b/lib/TAP/Base.pm index c203dee8..c9b13034 100644 --- a/lib/TAP/Base.pm +++ b/lib/TAP/Base.pm @@ -18,10 +18,7 @@ Version 3.51_01 our $VERSION = '3.51_01'; -use constant GOT_TIME_HIRES => do { - eval 'use Time::HiRes qw(time);'; - $@ ? 0 : 1; -}; +use Time::HiRes qw(time); =head1 SYNOPSIS @@ -107,19 +104,14 @@ sub _make_callback { =head3 C -Return the current time using Time::HiRes if available. +Return the current time. =cut sub get_time { return time() } -=head3 C - -Return true if the time returned by get_time is high resolution (i.e. if Time::HiRes is available). - -=cut - -sub time_is_hires { return GOT_TIME_HIRES } +# kept for backwards compatability +sub time_is_hires { return 1 } =head3 C diff --git a/lib/TAP/Formatter/Base.pm b/lib/TAP/Formatter/Base.pm index abf65308..59f6ca1c 100644 --- a/lib/TAP/Formatter/Base.pm +++ b/lib/TAP/Formatter/Base.pm @@ -141,7 +141,7 @@ Printing individual test results to STDOUT. =item * C -Append run time for each test to output. Uses L if available. +Append run time for each test to output. =item * C diff --git a/lib/TAP/Harness.pm b/lib/TAP/Harness.pm index 6d8b0691..e84bf564 100644 --- a/lib/TAP/Harness.pm +++ b/lib/TAP/Harness.pm @@ -156,8 +156,7 @@ Set the verbosity level: =item * C -Append run time for each test to output. Uses L if -available. +Append run time for each test to output. =item * C diff --git a/lib/Test/Harness.pm b/lib/Test/Harness.pm index 9f18930f..0a7baed2 100644 --- a/lib/Test/Harness.pm +++ b/lib/Test/Harness.pm @@ -14,16 +14,14 @@ use TAP::Parser::Source (); use TAP::Parser::SourceHandler::Perl (); use Text::ParseWords qw(shellwords); +use Time::HiRes 'time'; use Config; use base 'Exporter'; # $ML $Last_ML_Print -BEGIN { - eval q{use Time::HiRes 'time'}; - our $has_time_hires = !$@; -} +our $has_time_hires = 1; =head1 NAME