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;








0















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.










share|improve this question



















  • 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

















0















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.










share|improve this question



















  • 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













0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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












  • 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










2 Answers
2






active

oldest

votes


















0














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"/>





share|improve this answer






























    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;







    share|improve this answer























    • 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











    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
    );



    );













    draft saved

    draft discarded


















    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









    0














    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"/>





    share|improve this answer



























      0














      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"/>





      share|improve this answer

























        0












        0








        0







        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"/>





        share|improve this answer













        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"/>






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered May 16 at 17:23









        eKKiMeKKiM

        779319




        779319























            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;







            share|improve this answer























            • 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















            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;







            share|improve this answer























            • 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













            0












            0








            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;







            share|improve this answer













            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;








            share|improve this answer












            share|improve this answer



            share|improve this answer










            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

















            • 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

















            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

            Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

            What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company