archive_info: use timelocal correctly
Because we always have 4-digit years, we can simply pass the year itself to timelocal instead of subtracting 1900. Like this it will also work for years not in the range 2000-2999. See also: https://perldoc.perl.org/Time/Local.html#Year-Value-Interpretation Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
e0bbbb6f48
commit
b1ddc54a93
@ -1404,7 +1404,7 @@ sub archive_info {
|
||||
if ($volid =~ /^(vzdump-${type}-([1-9][0-9]{2,8})-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2}))\.${format_re}$/) {
|
||||
$info->{logfilename} = "$1.log";
|
||||
$info->{vmid} = int($2);
|
||||
$info->{ctime} = timelocal($8, $7, $6, $5, $4 - 1, $3 - 1900);
|
||||
$info->{ctime} = timelocal($8, $7, $6, $5, $4 - 1, $3);
|
||||
$info->{is_std_name} = 1;
|
||||
} else {
|
||||
$info->{is_std_name} = 0;
|
||||
|
||||
Reference in New Issue
Block a user