How Do You Programmatically Set the Hardware Clock on Linux?

前端 未结 5 1378
小蘑菇
小蘑菇 2020-12-08 22:50

Linux provides the stime(2) call to set the system time. However, while this will update the system\'s time, it does not set the BIOS hardware clock to match the new system

5条回答
  •  情书的邮戳
    2020-12-08 23:46

    I would also like to point out the hardware clock is only accurate to a point (I have seen systems that will loose/gain a couple of seconds a day).

    Have you considered setting up the network time daemon to sync your clock against a time server?

    Admittedly this syncing does not happen until after the daemon starts so keeping your hardware clock in sync also helps between the power up and the point the time daemon syncs against the time server.

提交回复
热议问题