We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parenta3036e0 commit97adafaCopy full SHA for 97adafa
src/STM32RTC.cpp
@@ -69,8 +69,14 @@ void STM32RTC::begin(bool resetTime, Hour_Format format)
69
, resetTime);
70
_timeSet = !reinit;
71
72
-syncTime();
73
syncDate();
+syncTime();
74
+
75
+/* fix race condition where date may have changed between reading date and time*/
76
+if (_seconds ==0 && _minutes ==0 && _hours ==0) {
77
+syncDate();
78
+ }
79
80
syncAlarmTime();
81
if (!IS_RTC_DATE(_alarmDay)) {
82
// Use current time to init alarm members,
@@ -1109,6 +1115,11 @@ time_t STM32RTC::getEpoch(uint32_t *subSeconds)
1109
1115
1110
1116
syncTime();
1111
1117
1118
1119
1120
1121
1122
1112
1123
tm.tm_isdst = -1;
1113
1124
/*
1114
1125
* mktime ignores the values supplied by the caller in the