Bug 795405 - All Dates in Price Database Off-By-One After 3.0 Upgrade

Also Bug 791825 - Accounting Period dates off by 1.
The DST start/end dates were reversed *and* the DST offset had the wrong
sign in Windows, resulting in the effective timezone always being one to
the west off (i.e. PDT was -9 and PST was -8).
This commit is contained in:
John Ralls
2018-04-27 13:27:47 -07:00
parent 83e993fb80
commit 9c4469d039
3 changed files with 23 additions and 9 deletions

View File

@@ -150,9 +150,15 @@ zone_from_regtzi (const RegTZI& regtzi, time_zone_names names)
{
using ndate = boost::gregorian::nth_day_of_the_week_in_month;
using nth_day_rule = boost::local_time::nth_day_of_the_week_in_month_dst_rule;
/* Note that Windows runs its biases backwards from POSIX and
* boost::date_time: It's the value added to the local time to get
* GMT rather than the value added to GMT to get local time; for
* the same reason the DaylightBias is negative as one generally
* adds an hour less to the local time to get GMT. Biases are in
* minutes.
*/
duration std_off (0, regtzi.StandardBias - regtzi.Bias, 0);
duration dlt_off (0, regtzi.DaylightBias, 0);
duration dlt_off (0, -regtzi.DaylightBias, 0);
duration start_time (regtzi.StandardDate.wHour, regtzi.StandardDate.wMinute,
regtzi.StandardDate.wSecond);
duration end_time (regtzi.DaylightDate.wHour, regtzi.DaylightDate.wMinute,
@@ -165,10 +171,10 @@ zone_from_regtzi (const RegTZI& regtzi, time_zone_names names)
{
try
{
ndate start (std_week_num, regtzi.StandardDate.wDayOfWeek,
regtzi.StandardDate.wMonth);
ndate end(dlt_week_num, regtzi.DaylightDate.wDayOfWeek,
regtzi.DaylightDate.wMonth);
ndate start (dlt_week_num, regtzi.DaylightDate.wDayOfWeek,
regtzi.DaylightDate.wMonth);
ndate end(std_week_num, regtzi.StandardDate.wDayOfWeek,
regtzi.StandardDate.wMonth);
dates.reset(new nth_day_rule (start, end));
}
catch (boost::gregorian::bad_month& err)