Merge pull request #2714 from ascillato/patch-3

Fix DST and STD times for Southern Hemisphere
This commit is contained in:
Theo Arends 2018-05-13 09:23:12 +02:00 committed by GitHub
commit 0db6a0bcaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 9 deletions

View File

@ -1389,17 +1389,22 @@ void RtcSecond()
if (local_time > 1451602800) { // 2016-01-01 if (local_time > 1451602800) { // 2016-01-01
int32_t time_offset = Settings.timezone * SECS_PER_HOUR; int32_t time_offset = Settings.timezone * SECS_PER_HOUR;
if (99 == Settings.timezone) { if (99 == Settings.timezone) {
dstoffset = DaylightSavingTime.offset * SECS_PER_MIN;
stdoffset = StandardTime.offset * SECS_PER_MIN;
if (DaylightSavingTime.hemis) { if (DaylightSavingTime.hemis) {
dstoffset = StandardTime.offset * SECS_PER_MIN; // Southern hemisphere // Southern hemisphere
stdoffset = DaylightSavingTime.offset * SECS_PER_MIN; if ((utc_time >= (standard_time - dstoffset)) && (utc_time < (daylight_saving_time - stdoffset))) {
time_offset = stdoffset; // Standard Time
} else {
time_offset = dstoffset; // Daylight Saving Time
}
} else { } else {
dstoffset = DaylightSavingTime.offset * SECS_PER_MIN; // Northern hemisphere // Northern hemisphere
stdoffset = StandardTime.offset * SECS_PER_MIN; if ((utc_time >= (daylight_saving_time - stdoffset)) && (utc_time < (standard_time - dstoffset))) {
} time_offset = dstoffset; // Daylight Saving Time
if ((utc_time >= (daylight_saving_time - stdoffset)) && (utc_time < (standard_time - dstoffset))) { } else {
time_offset = dstoffset; // Daylight Saving Time time_offset = stdoffset; // Standard Time
} else { }
time_offset = stdoffset; // Standard Time
} }
} }
local_time += time_offset; local_time += time_offset;