System clock always resyncs after setting it

Kimberly W asked:

I’m setting the system clock using the following command:

date -s "31 DEC 2015 12:00:00"

Immediately after executing I run just date and see that the date and time is December 31 2015. Then, after waiting about three seconds, I run date again and see that it has changed back to today’s date.

Why is it syncing again to the current date and how can I stop it?

[root@localhost mm]# date -s "31 DEC 2015 12:00:00"
Thu Dec 31 12:00:00 EST 2015
[root@localhost mm]# date
Thu Dec 31 12:00:02 EST 2015
[root@localhost mm]# date
Thu Dec 31 12:00:03 EST 2015
[root@localhost mm]# date
Mon Jan  4 11:53:17 EST 2016

All my currently running services:

[root@localhost mm]# service --status-all
atd (pid  2317) is running...
auditd (pid  1464) is running...
consul (pid  2332) is running...
crond (pid  2212) is running...
cupsd (pid  1562) is running...
dnsmasq is stopped
elasticsearch (pid  4046) is running...
service firstboot supports chkconfig, but is not referenced in any runlevel (run 'chkconfig --add firstboot')
firstboot is not scheduled to run
hald (pid  1604) is running...
htcacheclean is stopped
httpd (pid  7537) is running...
ip6tables: Firewall is not running.
iptables: Firewall is not running.
iscsi is stopped
iscsid is stopped
Checking jexec statuslvmetad is stopped
dmeventd is stopped
mdmonitor is stopped
memcached (pid 2181) is running...
messagebus (pid  1527) is running...
mongod (pid  2293) is running...
multipathd is stopped
mysqld (pid  2067) is running...
netconsole module not loaded
Configured devices:
lo eth0 eth1
Currently active devices:
lo eth0 eth1
NetworkManager (pid  1540) is running...
ntpd is stopped
portreserve is stopped
master dead but pid file exists
pppoe-server is stopped
rdisc is stopped
rsyslogd (pid  1498) is running...
sandbox is stopped
saslauthd is stopped
sendmail (pid  2288) is running...
sm-client (pid  2289) is running...
spice-vdagentd is stopped
openssh-daemon (pid  1811) is running...
The VirtualBox Additions are currently running.
Checking for VBoxService ...running
wdaemon is stopped
winbindd is stopped
wpa_supplicant (pid  1603) is running...

My answer:

It’s because your machine is a VirtualBox virtual machine, and

The VirtualBox Additions are currently running.

By default VirtualBox guests will sync their time to the host. If you want to change this behavior, see the documentation.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.