I have seen all these messages floating around about the time changing on the Vera’s and I wanted to help people get to the bottom of what is happening.
If you know better than me then please feel free to correct me, but here is my take on the situation.
Normally a Linux box has a hardware clock which keeps the right time even when the computer is switched off. During boot up Linux gets the current time from the hardware clock using the call ‘hwclock -s’ and during shutdown it stores the current time according to the operating system to that hardware clock using ‘hwclock -w’ to allow for any changes that have been made by software. The Vera being a router doesn’t have a hardware clock so although those commands exist and can be run from the command line neither of them will actually do anything for you.
As there is no hardware clock the Vera must get the correct time every time you switch it on and to do that it uses a little command called ‘rdate’. In brief the ‘rdate’ command is used as part of a hotplug event whenever the Vera connects to a network and a list of potential sources of time have been listed in the file /etc/config/timeserver, they are as follows:
ac-ntp0.net.cmu.edu
ptbtime1.ptb.de
ac-ntp1.net.cmu.edu
tick.greyware.com
ntp.xs4all.nl
ptbtime2.ptb.de
cudns.cit.cornell.edu
ptbtime3.ptb.de
I would suggest that the only reason that the clock would reset would be that your network connection has restarted and that could be a result of either strange network problems or your vera rebooting itself completely.
You can rapidly find out whether your Vera has completely rebooted by logging in via ssh to the Vera itself and typing the command ‘uptime’, which will give you something like:
16:27:48 up 14 days, 4:29, load average: 0.05, 0.14, 0.15
From this you can see that my Vera hasn’t been rebooted for 14 days.
However the question remains, why is the vera picking the wrong time. The answer to that must be that the rdate command is unable to get the right time, either because of an internet fault or a firewall. You therefore want to work out which timeserver is giving you the wrong time, or if any of them are giving you the right time. I would suggest opening an ssh connection to the Vera box itself and then running the following command:
rdate -p ac-ntp0.net.cmu.edu
See what you get, does it print the right time? If not you have found your problem, if it does give the right time then try the next timeserver in the list until you find one that gets it wrong. I believe the script that sets the time is coded in such a way that it will keep picking a timeserver to use at random until it gets a timeserver that tells it the time. If you have a timeserver in there that gives strange results then you will get it from time to time and your clock will bounce around.
Normally these sorts of problems are avoided by taking a couple of timeservers and checking that the times given match up, but rdate isn’t that advanced. As a simple bodge to solve the problem you could write a small script combining the ‘date’ command with ‘rdate’ to get the time in seconds since the epoch, download the time from two timeservers and compare the two. Having done that if the times look pretty close you could set the time. You might lose a few seconds of accuracy, but you could be pretty confident it was right.
If this answers the question please let me know.