UncleRus / esp-idf-lib

Component library for ESP32-xx and ESP8266
https://esp-idf-lib.readthedocs.io/en/latest/
1.35k stars 420 forks source link

populate tm_yday in ds3231_get_time() #574

Closed hezy0426 closed 11 months ago

UncleRus commented 11 months ago

I haven't read the code much, but I have a vague suspicion about this part:

...
    for (int i = 1; i < month; i++)
    {
        days += *ptr;
        ptr++;
    }
...

The fact is that in the struct tm month is 0-based: изображение

If everything is OK and I'm worrying in vain - tell me and I'll merge the PR into the master.

hezy0426 commented 11 months ago

Hi sir,

Amazing catch there! I have updated the code so that it will work with 0 based tm_mon. Quick and random screenshot to show you the result of printing 2023/12/31. image

UncleRus commented 11 months ago

Thank you!