ropg / ezTime

ezTime — pronounced "Easy Time" — is a very easy to use Arduino time and date library that provides NTP network time lookups, extensive timezone support, formatted time and date strings, user events, millisecond precision and more.
MIT License
336 stars 93 forks source link

Fixe for issue #38 #39

Closed wayfarerbasta closed 5 years ago

wayfarerbasta commented 5 years ago

The Function makeOrdinalTime does not work properly if you set the ordinal to 5 (Last dow in month and year) because you check if the value w is equal to 0 for the "Last week" rule. This will never happen. With the check if (w == 5) or if (ordinal ==0) the code works perfectly. This change fixes the issue #38

Tederean commented 5 years ago

Code:

Serial.println(local_tz->hour(now, UTC_TIME)); Serial.println(local_tz->dateTime(now, UTC_TIME));

Real Time: 24-Mar-2019 17:44:48 CET

Output without patch: 15 Sunday, 24-Mar-2019 17:44:48 DWEST

Output with applied patch: 17 Sunday, 24-Mar-2019 15:44:48 WEST

Seems that it causes a problem somewhere else....

wayfarerbasta commented 5 years ago

The fixe just corrects the wrong behavior of the makeOrdinalTime function. This function is interally used to determine the dst_start time. With the original function the dst_start was today because it identified the 24th March as the last sunday of March. With the applied fixe the makeOrdinalTime returns the correct time for the last Sunday in March (31st). For me it works fine. I dont use the timezone service. I defined e POSIX Timezone definition for my sketch.