@ChrisZang thanks for the reply.
The problem is that will only set up the time and DST offset if I request the time from the NTP server. When a DST transition occurs sometime later the clock will not automatically adjust without doing another request from the NTP server.
I have solved the problem by simply adding the code to advance or retard the clock at the appropriate time based on my timezone. i.e. first Sunday in April at 03:00 I change the clock to 02:00 and the first Sunday in October at 02:00 I change the clock to 03:00.
Latest posts made by johno
-
RE: Core2 RTC adjusting for DST
-
RE: MX Linux 19.4 Arduino IDE Copiling Error M5Stack Basic
You've switched from Linux to Windows!
Arduino 1.6.7 is quite old. I'd suggest updating to the latest. If that doesn't work then perhaps there may be a problem with the Arduino setup. You could try uninstalling and reinstalling the Arduino IDE. That's quite drastic but I can't see why you see that problem. When you remove the IDE you should also remove the 'Arduino15' folder. i.e. C:\Users(username)\AppData\Local\Arduino15
Also, perhaps remove all the comment lines in your sketch. It will make it easier to read and see if there is a problem there. -
RE: MX Linux 19.4 Arduino IDE Copiling Error M5Stack Basic
@stoni99 said in MX Linux 19.4 Arduino IDE Copiling Error M5Stack Basic:
2/2.0.2/
OK I have compiled it with the "Board" M5Stack-Core-ESP32. Same version as you. i.e. 2.0.2.
That "import serial" in your output is a mystery to me.
Try updating to the latest version of the core i.e.2.0.3 -
Core2 RTC adjusting for DST
I'd like to have the time automatically adjust for Daylight Saving time without having ge an NTP update.
The following code sets my timezone and DST correctly when it does an NTP update. But if I explicitly set the time and date to just before a DST change and observe the time, it doesn't change to the DST time.
I'd be grateful for any observations and suggesions.bool timeSync() {
configTime(0, 0, ntpServer); // get UTC time from NTP server
setenv("TZ", timezone, 1); // Set the TZ.
tzset();
if (!getLocalTime(&timeinfo)) {
Serial.print("Failed to obtain time from ");
Serial.println(ntpServer);
return false;
}
// Copy the time and date from the struct tm format into the M5Core2
// TimeStruct and write it into the RTC.
TimeStruct.Hours = timeinfo.tm_hour;
TimeStruct.Minutes = timeinfo.tm_min;
TimeStruct.Seconds = timeinfo.tm_sec;
DateStruct.Year = (timeinfo.tm_year + 1900);
DateStruct.Month = (timeinfo.tm_mon + 1);
DateStruct.Date = timeinfo.tm_mday;
DateStruct.WeekDay = timeinfo.tm_wday; // day of week. 0 = Sunday// TimeStruct.Hours = 2;
// TimeStruct.Minutes = 58;
// DateStruct.Month = 4;
// DateStruct.Date = 3;
// DateStruct.WeekDay = 0;
M5.Rtc.SetTime(&TimeStruct);
M5.Rtc.SetDate(&DateStruct);return true;
} -
RE: MX Linux 19.4 Arduino IDE Copiling Error M5Stack Basic
Hi Stoni99. Perhaps you could show us the code you're trying to compile.