fix #1819: fork_worker: ensure sync'ed workers control terminal
[pve-common.git] / src / PVE / CalendarEvent.pm
index 77b6008..3c08eb0 100644 (file)
@@ -177,9 +177,13 @@ sub compute_next_event {
 
        if ($utc) {
            (undef, $min, $hour, $mday, $mon, $year, $wday) = gmtime($last);
 
        if ($utc) {
            (undef, $min, $hour, $mday, $mon, $year, $wday) = gmtime($last);
+           # gmtime and timegm interpret two-digit years differently
+           $year += 1900;
            $startofday = timegm(0, 0, 0, $mday, $mon, $year);
        } else {
            (undef, $min, $hour, $mday, $mon, $year, $wday) = localtime($last);
            $startofday = timegm(0, 0, 0, $mday, $mon, $year);
        } else {
            (undef, $min, $hour, $mday, $mon, $year, $wday) = localtime($last);
+           # localtime and timelocal interpret two-digit years differently
+           $year += 1900;
            $startofday = timelocal(0, 0, 0, $mday, $mon, $year);
        }
 
            $startofday = timelocal(0, 0, 0, $mday, $mon, $year);
        }