System time issue with external RTC

2024-05-31 Thread cheshmedzhiev
Hi all, The testing conditions are: nuttx 2.12 runs on NUCLEO-U5A5ZJ-Q board. I have high accurate external RTC connected to one of i2c busses. When system runs for a long time - 2-3 days or more the time returned by date command is not accurate. When I reboot the system the system time become

Re: System time issue with external RTC

2024-05-31 Thread Michal Lenc
Hi, the right way to keep the system time in sync with external RTC is adjtime() function. https://man7.org/linux/man-pages/man3/adjtime.3.html NuttX also has its own implementation of adjtime() https://github.com/apache/nuttx/blob/master/sched/clock/clock_adjtime.c, so you can use it. Just en