]>
Commit | Line | Data |
---|---|---|
89a12446 DM |
1 | #!/usr/bin/perl -w |
2 | ||
3 | use strict; | |
d0817324 TL |
4 | use warnings; |
5 | ||
89a12446 | 6 | use File::stat; |
d0817324 | 7 | use POSIX qw(strftime); |
89a12446 DM |
8 | |
9 | sub testtime { | |
d0817324 | 10 | my $st = stat("/usr/bin/checktime") || stat("./checktime"); |
89a12446 DM |
11 | |
12 | my $ctime = time(); | |
13 | ||
14 | if ($ctime < $st->atime) { | |
d0817324 TL |
15 | my $system_time_str = strftime "%F %T", localtime $ctime; |
16 | my $pkg_time_str = strftime "%F %T", localtime $st->atime; | |
17 | warn "detected wrong system time $system_time_str, older than installer ($pkg_time_str)\n"; | |
89a12446 DM |
18 | my $tstr = localtime $st->atime; |
19 | # correct system time to avoid errors, i.e gpg fails | |
20 | system ("date -s '$tstr'"); | |
d0817324 | 21 | } |
89a12446 DM |
22 | } |
23 | ||
24 | testtime(); | |
25 | ||
26 | exit (0); |