skip_all => \&skip_all,
);
-my %features = ();
+my %features = (
+ usleep => \&init_usleep,
+);
sub import {
shift;
system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code;
}
+sub init_usleep {
+ my $usleep;
+
+ if (do { local $@; eval { require Time::HiRes; 1 } }) {
+ defined and diag "Using usleep() from Time::HiRes $_"
+ for $Time::HiRes::VERSION;
+ $usleep = \&Time::HiRes::usleep;
+ } else {
+ diag 'Using fallback usleep()';
+ $usleep = sub {
+ my $s = int($_[0] / 2.5e5);
+ sleep $s if $s;
+ };
+ }
+
+ return usleep => $usleep;
+}
+
package VPIT::TestHelpers::Guard;
sub new {