C
@nsmith I'll explain it like this. If I switich on the device and manually set the date and time to July 2nd, 2022 11:22:30 and leave the device running, it will keep the correct time with no need for any network/internet access, so at 15:25;12 on July 2nd 2022 I check the time and find the date and time to be correct. Then I switch the device off.
On July 2nd 15:55:12 I switch the device back on. What will the date and time be? The answer is not as you might expect, it is not July 2nd 15:55:12. This is because the device stores the date and time in volatile RAM, so when the power is removed this is lost. When the device starts up it attempts to correct the date and time using a script /etc/init.d/sysfixtime which looks for the latest timestamp on files in /etc, of course if none of these files have changed in months then this doesn't help much. You could run a cron job that touches a file in /etc every X number of minutes/hours, but again if your device is switched off for day you'll still lose a day on the clock. Also touching files in /etc too frequently is not a great idea as it increases wear on the RAM.
If your requirement is to simply track the duration of something regardless of whether the date and time are correct you can still do this. For example when your app starts up it might check the date and time (even if it is not correct), then later it could check date & time again and calculate the time difference between these two checks, just not the actual date and time.
I hope that helps.