Skip to content

Commit

Permalink
Minor changes to printlog
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Sep 5, 2016
1 parent e8e85db commit 49d8125
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions rbackup.pl
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ ($)
return (qw(sun mon tue wed thu fri sat))[$val];
}

sub printlog($){
my($text) = @_;
my ($sec,$min,$hour,$day,$month,$year) = gettime();
print LOG "$year-$month-$day $hour:$min:$sec $text\n";
}

sub gettime(){
my $input = time();
my ($sec,$min,$hour,$day,$month,$year) = (localtime($input))[0,1,2,3,4,5];
Expand All @@ -196,12 +202,6 @@ ()
return ($sec,$min,$hour,$day,$month,$year);
}

sub printlog($){
my($text) = @_;
my ($sec,$min,$hour,$day,$month,$year) = gettime();
print LOG "$year-$month-$day $hour:$min:$sec $text\n";
}

sub get_hostname(){
my $hostname = `/bin/hostname`;
chomp($hostname);
Expand Down

0 comments on commit 49d8125

Please sign in to comment.