0

Hi can any help me how timedatctl works my understanding are

  • if system clock sysnc with NTP serivce through internet system time will be updated to current date and time.

  • If system clock sync with NTP it will update the RTC every 11 min is this right ?

    root@NB2-SOC-BSP-ALPHA-V1:~# date --set="2025-02-02 12:00:00"
    Sun Feb  2 12:00:00 IST 2025
    root@NB2-SOC-BSP-ALPHA-V1:~# date
    Sun Feb  2 12:00:02 IST 2025
    
    root@NB2-SOC-BSP-ALPHA-V1:~# timedatectl
            Local time: Sun 2025-02-02 12:00:04 IST
        Universal time: Sun 2025-02-02 06:30:04 UTC
              RTC time: Sat 2022-03-05 11:07:29    
             Time zone: Asia/Kolkata (IST, +0530)  
    System clock synchronized: no                         
           NTP service: inactive                   
       RTC in local TZ: no 
    
    root@NB2-SOC-BSP-ALPHA-V1:~# timedatectl set-ntp true 
    root@NB2-SOC-BSP-ALPHA-V1:~# timedatectl
            Local time: Fri 2022-10-14 14:22:35 IST
        Universal time: Fri 2022-10-14 08:52:35 UTC
              RTC time: Sat 2022-03-05 11:07:39    
             Time zone: Asia/Kolkata (IST, +0530)  
    System clock synchronized: yes                        
           NTP service: active                     
       RTC in local TZ: no 
    
     root@NB2-SOC-BSP-ALPHA-V1:~# timedatectl
            Local time: Fri 2022-10-14 14:22:41 IST
        Universal time: Fri 2022-10-14 08:52:41 UTC
              RTC time: Sat 2022-03-05 11:07:45    
             Time zone: Asia/Kolkata (IST, +0530)  
      System clock synchronized: yes                        
           NTP service: active                     
       RTC in local TZ: no                         
    

After enabling NTP service only local + Universal time got updated but Not RTC time why ?

2
  • What linux distribution are you running?
    – PonJar
    Oct 17, 2022 at 7:05
  • I'm guessing that given you have SOC in the prompt, this is not your standard desktop. If so, you would to need update the question with details of the system, what rtc you have and whether the relevant overlays have been loaded.
    – Bib
    Oct 17, 2022 at 9:50

2 Answers 2

0

The following may be helpful regarding the second part of your understanding, taken from the man page of hwclock.

You should be aware of another way that the Hardware Clock is kept synchronized in some systems. The Linux kernel has a mode wherein it copies the System Time to the Hardware Clock every 11 minutes. This mode is a compile time option, so not all kernels will have this capability. This is a good mode to use when you are using something sophisticated like NTP to keep your System Clock synchronized. (NTP is a way to keep your System Time synchronized either to a time server somewhere on the network or to a radio clock hooked up to your system. See RFC 1305.)

If the kernel is compiled with the '11 minute mode' option it will be active when the kernel’s clock discipline is in a synchronized state. When in this state, bit 6 (the bit that is set in the mask 0x0040) of the kernel’s time_status variable is unset. This value is output as the 'status' line of the adjtimex --print or ntptime commands.

It takes an outside influence, like the NTP daemon to put the kernel’s clock discipline into a synchronized state, and therefore turn on '11 minute mode'. It can be turned off by running anything that sets the System Clock the old fashioned way, including hwclock --hctosys. However, if the NTP daemon is still running, it will turn '11 minute mode' back on again the next time it synchronizes the System Clock.

If your system runs with '11 minute mode' on, it may need to use either --hctosys or --systz in a startup script, especially if the Hardware Clock is configured to use the local timescale. Unless the kernel is informed of what timescale the Hardware Clock is using, it may clobber it with the wrong one. The kernel uses UTC by default.

The first userspace command to set the System Clock informs the kernel what timescale the Hardware Clock is using. This happens via the persistent_clock_is_local kernel variable. If --hctosys or --systz is the first, it will set this variable according to the adjtime file or the appropriate command-line argument. Note that when using this capability and the Hardware Clock timescale configuration is changed, then a reboot is required to notify the kernel.

hwclock --adjust should not be used with NTP '11 minute mode'.

I don’t know if the 11 minute mode is a normal capability for the kernel or not. I suspect it is.

Also check that systemd-timedated.service is running.

0

if system clock syncs with NTP service through internet system time will be updated to current date and time.

Yes, unless the system is so far out of sync that the NTP service assumes something is seriously wrong and gives up.

If system clock sync with NTP it will update the RTC every 11 min is this right ?

Possibly, but not always. The classic ntpd does this by default; chronyd does it only if the rtcsync keyword is used in the /etc/chrony/chrony.conf configuration file. For other NTP sync service implementations, see the documentation of that specific implementation.

You must log in to answer this question.

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