[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: setting the date for testing



On 2020-12-06 21:43, Michael Grant wrote:
I need to set the date to several years in the future in order to test something.  When I do this via the date command, the date returns back almost instantly (or within a few seconds).

# timedatectl set-time 2025-12-06 20:41:41

# date

Sat  6 Dec 20:41:43 GMT 2025

# date

Sat  6 Dec 20:41:44 GMT 2025

# date

Sun  6 Dec 20:41:48 GMT 2020

I’m not using ntp (that I know of).

# timedatectl timesync-status

Failed to query server: The name org.freedesktop.timesync1 was not provided by any .service files

# timedatectl show

Timezone=Europe/London

LocalRTC=no

CanNTP=no

NTP=no

NTPSynchronized=no

TimeUSec=Sun 2020-12-06 20:37:19 GMT

RTCTimeUSec=Sun 2020-12-06 18:51:22 GMT

How can I stop (temporarily) the system from automatically setting the date so that I can set it forward?

I encountered this type of thing myself a while ago as well. And, just like you, I thought there was no NTP running, but systemd had some tricks upon its sleeve.

Try this to see if it solves your troubles:

# timedatectl set-ntp true

Changes to the status of this service will not be immediately noticed by timedatectl. Thus, you'll have to enter the following command too:

# systemctl restart systemd-timedated.service

HTH

Grx HdV


Reply to: