You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Convert date/time struct tm to time_t
t = mktime(rdt);
// An offset is needed for AVR target
#ifdef ARDUINO_ARCH_AVR
t += UNIX_OFFSET;
#endif
// Return Unix epoch UTC
return t;
}
It helped me to get an automatic RTC update based on Compiled time&date in my application:
if (rtc.read(&rtc_dt))
{
Serial.println("Time fetched from RTC IC....");
}
else
{
Serial.println("Time NOT fetched from RTC IC....");
}
if (rtc.getEpoch(&dt) > rtc.getEpoch(&rtc_dt))
{
// Set new date time
Serial.print(F("Set RTC date time..."));
if (!rtc.write(&dt)) {
Serial.println(F("FAILED"));
} else {
Serial.println(F("OK"));
}
}
And of course no battery yet installed.
The text was updated successfully, but these errors were encountered:
Maybe add:
/*!
*/
time_t ErriezDS1307::getEpoch(struct tm *rdt)
{
time_t t;
#ifdef ARDUINO_ARCH_AVR
t += UNIX_OFFSET;
#endif
}
It helped me to get an automatic RTC update based on Compiled time&date in my application:
if (rtc.read(&rtc_dt))
{
Serial.println("Time fetched from RTC IC....");
}
else
{
Serial.println("Time NOT fetched from RTC IC....");
}
if (rtc.getEpoch(&dt) > rtc.getEpoch(&rtc_dt))
{
// Set new date time
Serial.print(F("Set RTC date time..."));
if (!rtc.write(&dt)) {
Serial.println(F("FAILED"));
} else {
Serial.println(F("OK"));
}
}
And of course no battery yet installed.
The text was updated successfully, but these errors were encountered: