Faking time on Debian 12

Sometimes you need to test stuff that only happens once a day, that can be tiresome to wait around for, so playing a bit of Deloran-style-prank on you Linux systems can be handy.

Start by disabling ntp:

root@lab1:~# timedatectl
               Local time: Sat 2023-12-02 05:54:58 CET
           Universal time: Sat 2023-12-02 04:54:58 UTC
                 RTC time: Sat 2023-12-02 04:54:59
                Time zone: Europe/Copenhagen (CET, +0100)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
root@lab1:~# timedatectl set-ntp false
root@lab1:~# timedatectl
               Local time: Sat 2023-12-02 05:55:09 CET
           Universal time: Sat 2023-12-02 04:55:09 UTC
                 RTC time: Sat 2023-12-02 04:55:10
                Time zone: Europe/Copenhagen (CET, +0100)
System clock synchronized: yes
              NTP service: inactive
          RTC in local TZ: no
root@lab1:~#

And then you can simply set whatever time you want:

root@test1:~/test# timedatectl set-time '2123-12-05 12:00:00'
root@test1:~/test# date
Sun Dec  5 12:00:01 PM CET 2123
Dette indlæg blev udgivet i Linux. Bogmærk permalinket.