mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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)
|
||||
|
Reference in New Issue
Block a user