Sorry, might be a bit off topic but I have been digging pretty deep into the OpenWrt OS of my vera plus over the past few days and have discovered a number of forgotten scripts.
As I found out, during boot up, the vera intervenes on its time with 5 different scripts!!!
First openWRT has an internal script which checks your entire file system and determines the latest updated file date and sets the time to that date. It is actually very well designed by openWRT developers.
“/etc/init.d/sysfixtime”. It is actually the first script the init.d runs.
Second, this script is from Mios, is run a little later in the boot sequence “/etc/init.d/mios_fix_time” which checks whether the unit has a battery and then updates the system time to a time saved in a file when the vera shut down. The problem is that file may not be saved if you brutally unplugged it or in case of power outage. If it was saved it will take the previous time and just add 1 minute as the supposed time it takes to reboot. It also updates to that time only if it determined that it got its time from the internet through a temporary file ("/tmp/.time_synced") created by a script which seem to no longer exists on my machine, otherwise by default it will reset the time to midnight Jan 1st 2000 if none of the conditions above occur. This is a little convoluted script which is overkill and does not work very well.
The third one is from the OS through the ntpclient which is run as a service and loads just before the cmh Luup engine starts.
The fourth one is through another OS service: ntpd, so there are actually 2 ntp services running and updating the time.
The fifth one is within the cmh Luup engine itself which calls an obsolete ntp sync program: “rdate” still residing on the vera through the “/usr/bin/sync_time.sh” script. On my Vera Plus, this script fails because it requires a “function.sh” file which is not where it thinks it is. The file is in /lib instead of /etc.
Overall this is a mess… When I reboot the vera I get a reboot time in my logs of 2min after Jan 1 2000 because my temp file never has the flag to indicate it got its time through an ntp server. I suspect it is because it is should be coming from rdate which is probably not working. I then get a Luup reload time which is accurate since it has been synced with ntp.
I have now killed 2 of the 5 scripts calling for the system time update… essentially the 2 mios ones and I am getting better time accuracy upon reboot.