0

I want to do tests with some time based applications.

I want to set the system time 3 days in the future or 5 years in the past.

CentOS 7 is not allowing me to do this.

Both commands below work, but after a few seconds the time is reset back to my current time. It's really annoying. NTP is not running. There is probably some other mechanism that is resetting the time to my current time.

  • timedatectl set-time "2019-08-30 18:17:16"
  • date -s '2014-12-25 12:34:56'

[root@qwerty ~]# timedatectl

  Local time: Wed 2019-08-28 20:41:00 CEST
  Universal time: Wed 2019-08-28 18:41:00 UTC
  RTC time: Fri 2019-08-30 16:26:36
  Time zone: XYZW ()
  NTP enabled: no
  NTP synchronized: no
  RTC in local TZ: no
  DST active: yes
  Last DST change: DST began at
              Sun 2019-03-31 01:59:59 CET
              Sun 2019-03-31 03:00:00 CEST
  Next DST change: DST ends (the clock jumps one hour backwards) at
              Sun 2019-10-27 02:59:59 CEST
              Sun 2019-10-27 02:00:00 CET
Subzero123
  • 49
  • 1
  • 6
  • Maybe `chronyd` is running. Best check with `ps aux | grep chrony`. – Thomas Aug 28 '19 at 19:01
  • No, it's not running. Neither ntpd nor chronyd are running. I checked before with **ps**. If it was running timedatectl would've said **NTP synchronized: yes** – Subzero123 Aug 28 '19 at 19:04
  • 1
    If this is a VM, you should ensure that it's not configured to sync time with the host system. –  Aug 28 '19 at 21:04
  • @yoonix Yep that was it (https://www.winklerweb.net/index.php/blog/11-tools/25-disabling-time-synchronization-in-virtualbox-ubuntu-16-04). Thank you so much. I thought it was some systemd fuckery :) – Subzero123 Aug 28 '19 at 21:20

0 Answers0