Skip to content

Commit

Permalink
Time::HiRes for sub-second sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
swelljoe committed May 27, 2017
1 parent b40d355 commit 41d9d2e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Virtualmin/Config/Plugin/NTP.pm
Expand Up @@ -3,6 +3,7 @@ use strict;
use warnings;
use 5.010;
use parent qw(Virtualmin::Config::Plugin);
use Time::HiRes qw( sleep );
my $log = Log::Log4perl->get_logger("virtualmin-config-system");

sub new {
Expand All @@ -14,15 +15,15 @@ sub new {
return $self;
}

my $clocksource;
# actions method performs whatever configuration is needed for this
# plugin. XXX Needs to make a backup so changes can be reverted.
sub actions {
my $self = shift;
my $clocksource;

$self->spin();
sleep 0.5;
eval { # try
sleep 0.5;
my $clockfile = "/sys/devices/system/clocksource/clocksource0/current_clocksource";
if (-e $clockfile) {
open(my $CLOCK, "<", $clockfile) or die "Couldn't open $clockfile: $!";
Expand Down

0 comments on commit 41d9d2e

Please sign in to comment.