Clock configuration: Difference between revisions

From Elvanör's Technical Wiki
Jump to navigation Jump to search
(New page: = Time zones = * The file /etc/localtime (which is normally a copy of a file in /usr/share/zoneinfo) contains time zone data. The date command (or any time the system must compute a date)...)
 
mNo edit summary
 
Line 3: Line 3:
* The file /etc/localtime (which is normally a copy of a file in /usr/share/zoneinfo) contains time zone data. The date command (or any time the system must compute a date) looks at this file to determine the actual time. So if you change it the computer time will also instantly change.
* The file /etc/localtime (which is normally a copy of a file in /usr/share/zoneinfo) contains time zone data. The date command (or any time the system must compute a date) looks at this file to determine the actual time. So if you change it the computer time will also instantly change.
* When the clock is initialized via the Gentoo /etc/init.d/clock script, the system looks at the hardware clock (which can be set to UTC or local time) and probably also at the TIMEZONE setting to guarantee a correct setup (if the data is correct of course). Thus if you change the timezone (/etc/localtime) and run /etc/init.d/clock restart, the time will be correct; if you later change the timezone file again, it won't (assuming you did not actually change your physical timezone).
* When the clock is initialized via the Gentoo /etc/init.d/clock script, the system looks at the hardware clock (which can be set to UTC or local time) and probably also at the TIMEZONE setting to guarantee a correct setup (if the data is correct of course). Thus if you change the timezone (/etc/localtime) and run /etc/init.d/clock restart, the time will be correct; if you later change the timezone file again, it won't (assuming you did not actually change your physical timezone).
= Network Time Protocol =
* It is recommended to run '''chrony''' rather than the plain '''ntp''' package. Chrony works better than ntp because it does not need to have an active network connection when starting, and copes better with transient networks outages (Wifi, etc).
* If you run '''ntp''', note that both '''ntp-client''' and '''ntpd''' must be added to init runlevels. ntpd is necessary to keep synchronizing the clock over time, it is not really a "server" component.

Latest revision as of 07:14, 15 April 2020

Time zones

  • The file /etc/localtime (which is normally a copy of a file in /usr/share/zoneinfo) contains time zone data. The date command (or any time the system must compute a date) looks at this file to determine the actual time. So if you change it the computer time will also instantly change.
  • When the clock is initialized via the Gentoo /etc/init.d/clock script, the system looks at the hardware clock (which can be set to UTC or local time) and probably also at the TIMEZONE setting to guarantee a correct setup (if the data is correct of course). Thus if you change the timezone (/etc/localtime) and run /etc/init.d/clock restart, the time will be correct; if you later change the timezone file again, it won't (assuming you did not actually change your physical timezone).

Network Time Protocol

  • It is recommended to run chrony rather than the plain ntp package. Chrony works better than ntp because it does not need to have an active network connection when starting, and copes better with transient networks outages (Wifi, etc).
  • If you run ntp, note that both ntp-client and ntpd must be added to init runlevels. ntpd is necessary to keep synchronizing the clock over time, it is not really a "server" component.