I have a strange issue I'm starting to troubleshoot and wondered if anyone would have any helpful tips.
I have a cronjob executed every minute that executes a script and appends the output to a file on a filer. The job prints the current timestamp since epoch (date +%s) and the current uptime uptime (including the current system time) to a file.
The script is:
DATE=`date +%s`
UPTIME=`uptime`
echo "$DATE;$UPTIME"
And what I get is:
1325770921; 14:42:01 up 17 days
1325775379; 14:43:01 up 17 days
1325771041; 14:44:01 up 17 days
Notice how the timestamp in the middle is ~1 hour 15 minutes off.. any ideas as to the cause?
You mention in the comments that you are running a virtual machine. Virtual machines should have an NTP client running continually correcting for the proper time and date. If you don't do this, the interaction between the physical hardware clock and the virtual clock can get messy and the time will drift.
Really, every system should run NTP, but in virtual machines it is critical instead of just recommended.
Linux and BSD environments should have both NTPd and OpenNTPd available; you didn't mention which environment you are using.
Depending on your VM it could be that your
Guest
clock is tied to thehosts
.Please check
See http://wiki.debian.org/Xen after heading 'clocksource/0: Time went backwards'. It's gives you some workaround to try if you happen to on a Xen VM.
We've had some funny time jumping with these and depending on how old your dom0 is and how new your domU guests are we've had to use
xen
andjiffies
to make the time behave and to be able to really use ntp on guests.