In the related post SetLocalTime reconfigures some GPIO I assumed you are not using any external RTC, because you were concerned that SetLocalTime() reconfigures pins which are connected to the external RTC.
For this reason I suggested to disable RtcSync.exe.
RtcSync.exe is required to …
load the external RTC’s time into the OS system clock at boot time, and
to write the time back to the external RTC whenever it has changed in the OS.
So without RtcSync.exe it is the expected behavior that you loose the time after a cold boot.
Conclusion
Re-enable RtcSync.exe
If required, let’s get back to the related issue SetLocalTime reconfigures some GPIO to discuss the actual problem behind the current behavior of RtcSync.exe, and how to fix it.
If you are not using an external RTC connected to SODIMM 194/196, can you please point out what is your approach to keep the correct time over a power cycle?
on my custom board I use the internal RTC, and I have a 7.2V Li Ion battery that is always connected through a dedicated 3.3V LDO regulator to the Vrtc (SODIMM 40).
For this reason I think that disabling RTCSync driver is absolutely safe (and necessary, since I use SODIMM 194 and 196 for other purposes).
If I disable RTCSync driver I see that datetime is reset to 01/01/2006 12:00 PM when I try to change it (on my custom board).
Since I know that debugging problems on custom hardware is difficult for you, I searched a way to reproduce it with the Evaluation Board.
I found a way and I described it in the first message of this topic.
I hope that this answer clarifies a little bit the situation and helps in finding the solution.
Now I understood the problem. We will need to do some analyses to find the root cause and solution. I will get back to you as soon as I have more information.
I have the same problem like vix described here.
My custom board have internal RTC and small backup 3.0V battery, I2C is connected to external temperature sensor.
When I turn off RTCSync.exe, date and time reset all the time.
We will solve the problem with the next image release V1.6, which is planned for December 2018. Meanwhile I’m afraid the only solution is to downgrade to image V1.5
the preview image is a big step in the right direction, but it doesn’t fix the issue completely, unfortunately.
First of all, the exact name of the parameter in rtc is useinternal (and not useInternalRTC).
So the right command is
set rtc.useinternal 1
save rtc
But this is only important for documentation.
The problem is that after every poweron, the Time Zone is reset to “GMT-08:00) Pacific Time (US & Canada)”.
Date and time doesn’t change (and so they seems ok), but as soon as you change the Time Zone to the right one, date and time change accordingly (and so they become wrong).