Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #229400 > unrolled thread

setting the date for testing

Started byMichael Grant <mgrant@grant.org>
First post2020-12-06 21:50 +0100
Last post2020-12-07 15:30 +0100
Articles 8 — 3 participants

Back to article view | Back to linux.debian.user


Contents

  setting the date for testing Michael Grant <mgrant@grant.org> - 2020-12-06 21:50 +0100
    Re: setting the date for testing "hdv@gmail" <hdv.jadev@gmail.com> - 2020-12-06 22:00 +0100
    Re: setting the date for testing "hdv@gmail" <hdv.jadev@gmail.com> - 2020-12-07 09:00 +0100
      RE: setting the date for testing Michael Grant <mgrant@grant.org> - 2020-12-13 14:40 +0100
        Re: setting the date for testing "hdv@gmail" <hdv.jadev@gmail.com> - 2020-12-13 15:10 +0100
          Re: setting the date for testing Michael Grant <mgrant@grant.org> - 2020-12-13 16:40 +0100
            Re: setting the date for testing "hdv@gmail" <hdv.jadev@gmail.com> - 2020-12-13 17:00 +0100
    Re: setting the date for testing Michael Stone <mstone@debian.org> - 2020-12-07 15:30 +0100

#229400 — setting the date for testing

FromMichael Grant <mgrant@grant.org>
Date2020-12-06 21:50 +0100
Subjectsetting the date for testing
Message-ID<Bj98K-6W2-3@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

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?

[toc] | [next] | [standalone]


#229401

From"hdv@gmail" <hdv.jadev@gmail.com>
Date2020-12-06 22:00 +0100
Message-ID<Bj9ip-6Zm-5@gated-at.bofh.it>
In reply to#229400
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

[toc] | [prev] | [next] | [standalone]


#229410

From"hdv@gmail" <hdv.jadev@gmail.com>
Date2020-12-07 09:00 +0100
Message-ID<BjjB7-52L-5@gated-at.bofh.it>
In reply to#229400
On 2020-12-06 21:56, hdv@gmail wrote:

 > # timedatectl set-ntp true

I am sorry for the typo. This should of course have been "false"!

Grx HdV

[toc] | [prev] | [next] | [standalone]


#229734

FromMichael Grant <mgrant@grant.org>
Date2020-12-13 14:40 +0100
Message-ID<BlzLs-7B3-9@gated-at.bofh.it>
In reply to#229410

[Multipart message — attachments visible in raw view] — view raw

This did not work:

# timedatectl set-ntp true
Failed to set ntp: NTP not supported
# timedatectl set-ntp false
Failed to set ntp: NTP not supported

Other ideas?

I am trying to set the date manually so that I can test the system set at future dates.  Setting the system using the date command, it just resets itself back to the current date/time after a few seconds.  How can I stop this?

Thanks!

Michael Grant
From: hdv@gmail
Sent: 07 December 2020 07:53
To: debian-user@lists.debian.org
Subject: Re: setting the date for testing

On 2020-12-06 21:56, hdv@gmail wrote:

 > # timedatectl set-ntp true

I am sorry for the typo. This should of course have been "false"!

Grx HdV

[toc] | [prev] | [next] | [standalone]


#229735

From"hdv@gmail" <hdv.jadev@gmail.com>
Date2020-12-13 15:10 +0100
Message-ID<BlAeu-80O-9@gated-at.bofh.it>
In reply to#229734
On 2020-12-13 14:36, Michael Grant wrote:
> This did not work:
> 
> # timedatectl set-ntp true
> 
> Failed to set ntp: NTP not supported
> 
> # timedatectl set-ntp false
> 
> Failed to set ntp: NTP not supported
> 
> Other ideas?
> 
> I am trying to set the date manually so that I can test the system set 
> at future dates.  Setting the system using the date command, it just 
> resets itself back to the current date/time after a few seconds.  How 
> can I stop this?
> 
> Thanks!
> 
> Michael Grant
> 
> *From: *hdv@gmail <mailto:hdv.jadev@gmail.com>
> *Sent: *07 December 2020 07:53
> *To: *debian-user@lists.debian.org <mailto:debian-user@lists.debian.org>
> *Subject: *Re: setting the date for testing
> 
> On 2020-12-06 21:56, hdv@gmail wrote:
> 
>  > # timedatectl set-ntp true
> 
> I am sorry for the typo. This should of course have been "false"!
> 
> Grx HdV
> 

Could it be that you have systemd-timesyncd running?

BTW, this is what I do to manually/explicitly set the system time (taken 
verbatim from my vimwiki, so don't mind the wording):

Changing the Current Date:

# timedatectl set-time <YYYY-MM-DD>

Or both at once:

# timedatectl set-time <YYYY-MM-DD> <HH:MM:SS>

This commands will fail if an NTP service is enabled. The NTP service 
can be enabled and disabled using a command as follows:

# timedatectl set-ntp <true|false>

Changes to the status of chrony or ntpd will not be immediately noticed 
by timedatectl. If changes to the configuration or status of these tools 
are made, enter the following command:

# systemctl restart systemd-timedated.service

By default, the system is configured to use UTC. To configure your 
system to maintain the clock in the local time, run the timedatectl 
command with the set-local-rtc option as root:

# timedatectl set-local-rtc <boolean>

HTH

Grx HdV

[toc] | [prev] | [next] | [standalone]


#229736

FromMichael Grant <mgrant@grant.org>
Date2020-12-13 16:40 +0100
Message-ID<BlBDz-n1-9@gated-at.bofh.it>
In reply to#229735

[Multipart message — attachments visible in raw view] — view raw

> Could it be that you have systemd-timesyncd running?
> 
> BTW, this is what I do to manually/explicitly set the system time (taken
> verbatim from my vimwiki, so don't mind the wording):
> 
> Changing the Current Date:
> 
> # timedatectl set-time <YYYY-MM-DD>
> 
> Or both at once:
> 
> # timedatectl set-time <YYYY-MM-DD> <HH:MM:SS>
> 
> This commands will fail if an NTP service is enabled. The NTP service can be
> enabled and disabled using a command as follows:
> 
> # timedatectl set-ntp <true|false>
> 
> Changes to the status of chrony or ntpd will not be immediately noticed by
> timedatectl. If changes to the configuration or status of these tools are
> made, enter the following command:
> 
> # systemctl restart systemd-timedated.service
> 
> By default, the system is configured to use UTC. To configure your system to
> maintain the clock in the local time, run the timedatectl command with the
> set-local-rtc option as root:
> 
> # timedatectl set-local-rtc <boolean>

I tried stopping systemd-timedated and ntp:

# systemctl stop systemd-timedated.service
# systemctl stop ntp

Then:

# timedatectl set-time 2025-12-13 14:01:42

and here's what I see by running date every few seconds:

# date
Sat 13 Dec 14:01:43 GMT 2025
# date
Sat 13 Dec 14:01:44 GMT 2025
# date
Sun 13 Dec 14:01:48 GMT 2020
# date
Sun 13 Dec 14:01:49 GMT 2020

I can't see anything running that would re-set the date.

This is a VM running inside virtualbox.  I just figured it out, it WAS
using the hardware clock.  I shut down the VM and ran this on the
host:

VBoxManage modifyvm MyVM --biossystemtimeoffset 126230400000

and now when it booted, I saw this:

$ date
Sun 13 Dec 15:29:47 GMT 2020
$ date
Fri 13 Dec 15:29:59 GMT 2024
$ date
Fri 13 Dec 15:30:00 GMT 2024
$ date
Fri 13 Dec 15:30:01 GMT 2024
$ date
Fri 13 Dec 15:30:01 GMT 2024
$ date
Fri 13 Dec 15:31:49 GMT 2024

and now it appears to stick.  So I'm good.  Thanks for your help though!

Michael Grant

[toc] | [prev] | [next] | [standalone]


#229737

From"hdv@gmail" <hdv.jadev@gmail.com>
Date2020-12-13 17:00 +0100
Message-ID<BlBWV-tJ-1@gated-at.bofh.it>
In reply to#229736
On 2020-12-13 16:34, Michael Grant wrote:
> 
> and now it appears to stick.  So I'm good.  Thanks for your help though!
> 
> Michael Grant

Glad to read you have solved it.

Grx HdV

[toc] | [prev] | [next] | [standalone]


#229414

FromMichael Stone <mstone@debian.org>
Date2020-12-07 15:30 +0100
Message-ID<BjpGy-GP-1@gated-at.bofh.it>
In reply to#229400
On Sun, Dec 06, 2020 at 08:43:51PM +0000, 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).

Depending on what you're doing you may want to look at the faketime or 
datefudge packages.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web