Is my RTC ds3231 dead

Hello, I have a problem where the weekday is displaying as a lower number, for example, as of posting this thread, today should be day number 5, RTC shows its 4.

I did this modification where I update the time from an NTP
server, and as you can see, for some reason setting the time as when the sketch was compiled, works but the manual setting does not.

Posting images of code is nearly worthless. Read the forum guidelines. Post your test code in code tags. Use the IDE autoformat tool (ctrl-t or Tools, Auto Format) to indent the code for readability before posting code.

void updateDate(RTC_DS3231 rtc)
{
    configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
    struct tm timeinfo;
    if (!getLocalTime(&timeinfo))
    {
        Serial.println("Failed to obtain time");
        return;
    }

    int year = timeinfo.tm_year;
    byte month = timeinfo.tm_mon + 1;
    byte day = timeinfo.tm_mday;

    byte hour = timeinfo.tm_hour;
    byte minute = timeinfo.tm_min;
    byte second = timeinfo.tm_sec;
    rtc.adjust(DateTime(year, month, day, hour, minute, second));
    char buf3[] = "YYYY MM DD DDD-hh:mm:ss";
    Serial.println(rtc.now().toString(buf3));
    Serial.println("DATE UPDATED");

    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    char buf2[] = "YYYY MM DD DDD-hh:mm:ss";
    Serial.println(rtc.now().toString(buf2));
    Serial.println("DATE UPDATED");
}
void configRTC(RTC_DS3231 rtc, bool update)
{
    if (!rtc.begin())
    {
        Serial.println("Couldn't find RTC!");
        Serial.flush();
        abort();
    }

    rtc.disable32K();
    rtc.writeSqwPinMode(DS3231_OFF);

    if (update)
    {
        updateDate(rtc);
    }
}```

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.