mirror of https://github.com/arendst/Tasmota.git
Merge pull request #2714 from ascillato/patch-3
Fix DST and STD times for Southern Hemisphere
This commit is contained in:
commit
0db6a0bcaf
|
@ -1389,19 +1389,24 @@ 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) {
|
||||||
if (DaylightSavingTime.hemis) {
|
dstoffset = DaylightSavingTime.offset * SECS_PER_MIN;
|
||||||
dstoffset = StandardTime.offset * SECS_PER_MIN; // Southern hemisphere
|
|
||||||
stdoffset = DaylightSavingTime.offset * SECS_PER_MIN;
|
|
||||||
} else {
|
|
||||||
dstoffset = DaylightSavingTime.offset * SECS_PER_MIN; // Northern hemisphere
|
|
||||||
stdoffset = StandardTime.offset * SECS_PER_MIN;
|
stdoffset = StandardTime.offset * SECS_PER_MIN;
|
||||||
|
if (DaylightSavingTime.hemis) {
|
||||||
|
// Southern hemisphere
|
||||||
|
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 {
|
||||||
|
// Northern hemisphere
|
||||||
if ((utc_time >= (daylight_saving_time - stdoffset)) && (utc_time < (standard_time - dstoffset))) {
|
if ((utc_time >= (daylight_saving_time - stdoffset)) && (utc_time < (standard_time - dstoffset))) {
|
||||||
time_offset = dstoffset; // Daylight Saving Time
|
time_offset = dstoffset; // Daylight Saving Time
|
||||||
} else {
|
} else {
|
||||||
time_offset = stdoffset; // Standard Time
|
time_offset = stdoffset; // Standard Time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
local_time += time_offset;
|
local_time += time_offset;
|
||||||
time_timezone = time_offset / 360; // (SECS_PER_HOUR / 10) fails as it is defined as UL
|
time_timezone = time_offset / 360; // (SECS_PER_HOUR / 10) fails as it is defined as UL
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue