RTLL8722DM_mini rtc not getting set properly

Hello

I a m using NTPClient to get unix epoch and setting ( setting real time clock RTC ) it using following code

unsigned long epochTime = timeClient.getEpochTime();
and then I use

rtc.Write(epochTime);

and then I am using following code to read back values I just wrote ( after few statements )
Serial.print("read back ecpoch = ");
Serial.println(rtc.Read());

and read back value is way off , what I am doing wrong…?

-Thanks
-Alok

1 Like

Hi @Alok_Kumar_Mishra

I think its mentioned in the library author’s note,

This function doesn’t return time in the same format as the getFormattedTime() function, so you will have to pay attention to how its formatting, detailes of the code can be found here

Hello,

thanks for code referral, but my question is after using rtc,Write(NTPclient.getEpochTime()) read back values should differ by few seconds , but in my case it is different by factors of thousands , for example using ntp time I am getting followings

date and time =22/12/2021 1:41:44
Seconds since Jan 1 1970 = 1640137304
and after writing to relal time clock I when I read back I am getting
read back ecpoch = 1608514904 ,why it is so much difference , I am not able to comprehend…?

-Thanks
-Alok