CentOS 7 - how does timedatectl sync time and date without NTP?NTP / SNTP and UTC TimeHow to set a frequent period for NTP client to sync with the NTP serverNTP time sync over PROXYSingle NTP server on isolate networkCisco Switch NTP client Clock is unsynchronized, stratum 16, no reference clockntpdate and ntpd failing to sync clock on LinuxSynchronize clock with NTP while online, and with RTC while offline?Is there a way to determine how often Chrony is querying NTP servers to sync time?Domain Controller time won't sync with NTP serverWhat sources does public NTP servers use to ensure time sync?
The deliberate use of misleading terminology
Is it possible to kill all life on Earth?
Can a helicopter mask itself from Radar?
Different PCB color ( is it different material? )
If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?
Fastest way to perform complex search on pandas dataframe
How crucial is a waifu game storyline?
If I create magical darkness with the Silent Image spell, can I see through it if I have the Devil's Sight warlock invocation?
Uncommanded roll at high speed
Could IPv6 make NAT / port numbers redundant?
What is game ban VS VAC ban in steam?
Mother abusing my finances
What are the problems in teaching guitar via Skype?
Draw a checker pattern with a black X in the center
What's the most polite way to tell a manager "shut up and let me work"?
Why use water tanks from a retired Space Shuttle?
Where can I find the list of all tendons in the human body?
Expenditure in Poland - Forex doesn't have Zloty
How was Apollo supposed to rendezvous in the case of a lunar abort?
Humans meet a distant alien species. How do they standardize? - Units of Measure
Thousands and thousands of words
Did airlines fly their aircraft slower in response to oil prices in the 1970s?
When a current flow in an inductor is interrupted, what limits the voltage rise?
Beginner's snake game using PyGame
CentOS 7 - how does timedatectl sync time and date without NTP?
NTP / SNTP and UTC TimeHow to set a frequent period for NTP client to sync with the NTP serverNTP time sync over PROXYSingle NTP server on isolate networkCisco Switch NTP client Clock is unsynchronized, stratum 16, no reference clockntpdate and ntpd failing to sync clock on LinuxSynchronize clock with NTP while online, and with RTC while offline?Is there a way to determine how often Chrony is querying NTP servers to sync time?Domain Controller time won't sync with NTP serverWhat sources does public NTP servers use to ensure time sync?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am creating automated tests for an rsync-like utility and I need to be able to set the clock back 24 hours for one of the tests. However, when I use timedatectl to set the time and date they revert back to the current time after 15 seconds.
Checking timedatectl status I see that it is not running NTP:
# timedatectl status
Local time: Wed 2019-05-15 23:24:17 EDT
Universal time: Thu 2019-05-16 03:24:17 UTC
RTC time: Wed 2019-01-16 02:13:40
Time zone: America/New_York (EDT, -0400)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 EST
Sun 2019-03-10 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
I also checked and NTPD is not running and nothing is bound to port 123.
Does timedatectl have another method of syncing time? The CentOS 7 test machine is running in a Docker container under a VirtualBox image so Internet connectivity is somewhat limited. I am also testing on CentOS directly on VirtualBox so I will need to solve for the non-Docker case as well.
ntp time-synchronization
add a comment |
I am creating automated tests for an rsync-like utility and I need to be able to set the clock back 24 hours for one of the tests. However, when I use timedatectl to set the time and date they revert back to the current time after 15 seconds.
Checking timedatectl status I see that it is not running NTP:
# timedatectl status
Local time: Wed 2019-05-15 23:24:17 EDT
Universal time: Thu 2019-05-16 03:24:17 UTC
RTC time: Wed 2019-01-16 02:13:40
Time zone: America/New_York (EDT, -0400)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 EST
Sun 2019-03-10 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
I also checked and NTPD is not running and nothing is bound to port 123.
Does timedatectl have another method of syncing time? The CentOS 7 test machine is running in a Docker container under a VirtualBox image so Internet connectivity is somewhat limited. I am also testing on CentOS directly on VirtualBox so I will need to solve for the non-Docker case as well.
ntp time-synchronization
1
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06
add a comment |
I am creating automated tests for an rsync-like utility and I need to be able to set the clock back 24 hours for one of the tests. However, when I use timedatectl to set the time and date they revert back to the current time after 15 seconds.
Checking timedatectl status I see that it is not running NTP:
# timedatectl status
Local time: Wed 2019-05-15 23:24:17 EDT
Universal time: Thu 2019-05-16 03:24:17 UTC
RTC time: Wed 2019-01-16 02:13:40
Time zone: America/New_York (EDT, -0400)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 EST
Sun 2019-03-10 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
I also checked and NTPD is not running and nothing is bound to port 123.
Does timedatectl have another method of syncing time? The CentOS 7 test machine is running in a Docker container under a VirtualBox image so Internet connectivity is somewhat limited. I am also testing on CentOS directly on VirtualBox so I will need to solve for the non-Docker case as well.
ntp time-synchronization
I am creating automated tests for an rsync-like utility and I need to be able to set the clock back 24 hours for one of the tests. However, when I use timedatectl to set the time and date they revert back to the current time after 15 seconds.
Checking timedatectl status I see that it is not running NTP:
# timedatectl status
Local time: Wed 2019-05-15 23:24:17 EDT
Universal time: Thu 2019-05-16 03:24:17 UTC
RTC time: Wed 2019-01-16 02:13:40
Time zone: America/New_York (EDT, -0400)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2019-03-10 01:59:59 EST
Sun 2019-03-10 03:00:00 EDT
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2019-11-03 01:59:59 EDT
Sun 2019-11-03 01:00:00 EST
I also checked and NTPD is not running and nothing is bound to port 123.
Does timedatectl have another method of syncing time? The CentOS 7 test machine is running in a Docker container under a VirtualBox image so Internet connectivity is somewhat limited. I am also testing on CentOS directly on VirtualBox so I will need to solve for the non-Docker case as well.
ntp time-synchronization
ntp time-synchronization
edited May 16 at 13:18
Not a machine
asked May 16 at 3:41
Not a machineNot a machine
32
32
1
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06
add a comment |
1
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06
1
1
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06
add a comment |
2 Answers
2
active
oldest
votes
VBox Guest Additions includes and enables time syncronisation with the host by default.
You can disable this with the following command:
vboxmanage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Or add the following line to your yourVM.vbox file
<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
add a comment |
timedatectl is called by systemd after specific frequency it checks /etc/adjtime, /usr/share/zoneinfo/, /etc/localtime and many other files to check if any info is available, it having it's own logic to adjust the clock without using ntp.
static int context_write_data_timezone(Context *c)
_cleanup_free_ char *p = NULL;
int r = 0;
assert(c);
if (isempty(c->zone))
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
r = -errno;
return r;
p = strappend("../usr/share/zoneinfo/", c->zone);
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
return 0;
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f967493%2fcentos-7-how-does-timedatectl-sync-time-and-date-without-ntp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
VBox Guest Additions includes and enables time syncronisation with the host by default.
You can disable this with the following command:
vboxmanage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Or add the following line to your yourVM.vbox file
<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
add a comment |
VBox Guest Additions includes and enables time syncronisation with the host by default.
You can disable this with the following command:
vboxmanage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Or add the following line to your yourVM.vbox file
<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
add a comment |
VBox Guest Additions includes and enables time syncronisation with the host by default.
You can disable this with the following command:
vboxmanage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Or add the following line to your yourVM.vbox file
<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
VBox Guest Additions includes and enables time syncronisation with the host by default.
You can disable this with the following command:
vboxmanage setextradata <vmname> "VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" "1"
Or add the following line to your yourVM.vbox file
<ExtraDataItem name="VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled" value="1"/>
answered May 16 at 17:23
eKKiMeKKiM
779319
779319
add a comment |
add a comment |
timedatectl is called by systemd after specific frequency it checks /etc/adjtime, /usr/share/zoneinfo/, /etc/localtime and many other files to check if any info is available, it having it's own logic to adjust the clock without using ntp.
static int context_write_data_timezone(Context *c)
_cleanup_free_ char *p = NULL;
int r = 0;
assert(c);
if (isempty(c->zone))
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
r = -errno;
return r;
p = strappend("../usr/share/zoneinfo/", c->zone);
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
return 0;
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
add a comment |
timedatectl is called by systemd after specific frequency it checks /etc/adjtime, /usr/share/zoneinfo/, /etc/localtime and many other files to check if any info is available, it having it's own logic to adjust the clock without using ntp.
static int context_write_data_timezone(Context *c)
_cleanup_free_ char *p = NULL;
int r = 0;
assert(c);
if (isempty(c->zone))
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
r = -errno;
return r;
p = strappend("../usr/share/zoneinfo/", c->zone);
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
return 0;
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
add a comment |
timedatectl is called by systemd after specific frequency it checks /etc/adjtime, /usr/share/zoneinfo/, /etc/localtime and many other files to check if any info is available, it having it's own logic to adjust the clock without using ntp.
static int context_write_data_timezone(Context *c)
_cleanup_free_ char *p = NULL;
int r = 0;
assert(c);
if (isempty(c->zone))
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
r = -errno;
return r;
p = strappend("../usr/share/zoneinfo/", c->zone);
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
return 0;
timedatectl is called by systemd after specific frequency it checks /etc/adjtime, /usr/share/zoneinfo/, /etc/localtime and many other files to check if any info is available, it having it's own logic to adjust the clock without using ntp.
static int context_write_data_timezone(Context *c)
_cleanup_free_ char *p = NULL;
int r = 0;
assert(c);
if (isempty(c->zone))
if (unlink("/etc/localtime") < 0 && errno != ENOENT)
r = -errno;
return r;
p = strappend("../usr/share/zoneinfo/", c->zone);
if (!p)
return log_oom();
r = symlink_atomic(p, "/etc/localtime");
if (r < 0)
return r;
return 0;
answered May 16 at 14:07
asktyagiasktyagi
35619
35619
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
add a comment |
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
Thanks! When I run "systemctl list-units --all | grep time" I do not see timedatectl. Is it embedded in another service or called by another name?
– Not a machine
May 16 at 16:52
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f967493%2fcentos-7-how-does-timedatectl-sync-time-and-date-without-ntp%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You can't set the time separately in a Docker container. It is always the time of the host. Use a fake time library for your application tests.
– Michael Hampton♦
May 16 at 4:41
Thanks Michael. Oddly enough, I am seeing the same behavior with CentOS 7 running directly in VirtualBox and not in Docker so there must be something more to this.
– Not a machine
May 16 at 13:11
@Notamachine did you install the VBox Guest Additions. This also includes a time sync with the host. virtualbox.org/manual/ch09.html#fine-tune-timers
– eKKiM
May 16 at 14:48
@eKKiM Yes I did! I looked for 30 minutes in VBox proper but not in the Guest Additions. I will check that now.
– Not a machine
May 16 at 16:53
@eKKiM That solved the problem. I disabled time sync in Guest Additions and that solved the problem both for the client and for the Docker image. If you want to submit that as an answer I will mark it as correct.
– Not a machine
May 16 at 17:06