[pve-devel] [PATCH common 1/3] fix #1963: don't do day-time related math on time stamps

Wolfgang Link w.link at proxmox.com
Wed Oct 31 11:49:56 CET 2018


Tested with this fixup command and it works like as should.

> Wolfgang Bumiller <w.bumiller at proxmox.com> hat am 31. Oktober 2018 um 11:33 geschrieben:
> 
> 
> On Wed, Oct 31, 2018 at 10:54:16AM +0100, Wolfgang Bumiller wrote:
> > Since our schedules are usually written in local time, we
> > cannot actually perform calculations using time stamps as
> > for instance adding 3600 (1 hour) may yield the exact same
> > local time as before when translated to the current timezone
> > during a DST change, or might skip an hour. Thus, 2:30am + 1
> > hour can be all of 2:30am, 3:30am or 4:30am.

> > +    outer: for (my $i = 0; $i < 1000; ++$i) {
> > +	my $wday = $t->[-1];
> 
> This should be $t->[6]; (Originally I had the result of localtime()
> truncated to only the values I use in the time helpers above...)
> 
> > +	foreach my $d (@$dowspec) {
> > +	    goto this_wday if $d == $wday;
> > +	    if ($d > $wday) {
> > +		$t->[0] = $t->[1] = $t->[2] = 0; # sec = min = hour = 0
> > +		$t = time_add_days($t, $d - $wday);




More information about the pve-devel mailing list