How does Ubuntu determine the date/time if no NTP server and a broken RTC clock?

by Hugh McCurdy   Last Updated September 11, 2019 23:02 PM

I am trying to determine how Ubuntu 18.04 determines how to set the system clock for a computer that has a broken RTC clock and no access an NTP server and systemd-timesyncd disabled. Upon the boot the time is always 2018-01-28 10:58:48 EST. This appears very similar to

Prevent clock from advancing to a system time after Ubuntu Server build time

Where the time is reported as 2018-01-28 15:58. The only advice he got was to turn off timesyncd, which I already have disabled and also didn't solve his problem.

Normally, an application starts, gets a GPS signal, sets the clock and starts running. But it doesn't really need GPS to run. What it does need is for the clock to not go backwards in time. I thought I might be able to fix that if I knew how Ubuntu decides to set the time to 2018-01-28 10:58:48 EST.

One thing I did try was to enable systemd-timesyncd. While the computer isn't normally connected to the Internet, as a maintenance procedure, I may connect it. Then I get the correct time and it touch(es) a file at /var/lib/private/systemd/timesync/clock. If I disconnect from the Internet and manually touch the file, the next boot will use that time. But even that approach, while better, still can set the clock backwards as it effectively remembers the last time the computer was connected to the Internet.

That aside, it seems a mystery that Ubuntu would use the same time at boot if it can't determine a time and that time isn't something like Jan 1 of some year. If I knew what Linux was doing, I might be able to craft a solution. So far, except for the URL above, what I find is a lot of "how to use NTP" and "Using NTP is a good idea" etc. I would if I could but no Internet except in maintenance mode.

Tags : 18.04 time


Related Questions



Lost autocompletion in Time&Date location dialog

Updated June 16, 2015 12:01 PM

How does Ubuntu synchronize time without ntp?

Updated July 01, 2015 13:00 PM

Wrong time on Thunderbird

Updated August 06, 2015 18:01 PM

Time shown isn't correct

Updated August 12, 2015 19:00 PM