2

In a new notebook, I configured Ubuntu to automatically sync time. Timezone is set to UTC +8. There is no problem with date when the notebook is connected to Internet.

But when I started the notebook in air gap (offline) mode, I noticed date time displayed by Ubuntu is incorrect. I can confirm that both date and date -u returned incorrect date. No TZ set in terminal. The date in UEFI menu is still the correct one. I believe that date is not using date from notebook clock. How date resolve date in this case?

I tried to set time in UEFI menu to 07/09/2016 21:04:xx and executed the following commands:

$ date
Ahd Jul 10 05:04:25 MYT 2016
$ date -u
Sab Jul  9 21:04:26 UTC 2016
$ sudo hwclock
Ahad 10 Jul 2016 05:04:35  MYT  .057058 seconds
$ sudo hwclock --localtime
Sabtu 09 Jul 2016 09:04:39  MYT  .813741 seconds

The date I set in UEFI now become the result for date -u while it should be the result for date. Is this has something to do with EUFI time service?

2 Answers 2

2

As you already mentioned, there are two different clocks:

  1. The software clock is set and used by the linux kernel and provides the time for all programs
  2. The hardware clock (real time clock (RTC)) has battery backup power (i.e. is always running) and is used to adjust the system clock on boot

UEFI has no access to the system clock and thus uses the RTC. date uses the system clock. The reason why it is properly working when there is an internet connection might be a running ntp service which adjust the time on startup?

You might want to use sudo dpkg-reconfigure tzdata for a text based option to set your system time properly. If Ubuntu will still display your last login date (really?) after reboot, there seems to be an issue with the RTC based system clock initialization on startup.

Source: man rtc

1
  • It is not always my last login date, I've updated my question and included the result for date and hwclock. Is Ubuntu reading time from EUFI time service or directly from RTC?
    – newbie
    Jul 9, 2016 at 13:19
0

Looks like Ubuntu (since version 15?) assumes that RTC is in UTC by default. Here is the result of timedatectl command:

$ timedatectl
      Local time: Ahd 2016-07-10 16:07:28 MYT
  Universal time: Ahd 2016-07-10 08:07:28 UTC
        RTC time: Ahd 2016-07-10 08:07:28
       Time zone: Asia/Kuala_Lumpur (MYT, +0800)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

I'll need to make sure the rest of OSes installed in the system to treat RTC in UTC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .