clock.xml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-config-clock" revision="systemd">
  8. <?dbhtml filename="clock.html"?>
  9. <title>Configuring the system clock</title>
  10. <indexterm zone="ch-config-clock">
  11. <primary sortas="d-clock">clock</primary>
  12. <secondary>configuring</secondary></indexterm>
  13. <para>This section discusses how to configure the
  14. <command>systemd-timedated</command> system service, which configures
  15. the system clock and timezone.</para>
  16. <para>If you cannot remember whether or not the hardware clock is set to UTC,
  17. find out by running the <userinput>hwclock --localtime --show</userinput>
  18. command. This will display what the current time is according to the hardware
  19. clock. If this time matches whatever your watch says, then the hardware clock is
  20. set to local time. If the output from <command>hwclock</command> is not local
  21. time, chances are it is set to UTC time. Verify this by adding or subtracting
  22. the proper amount of hours for the timezone to the time shown by
  23. <command>hwclock</command>. For example, if you are currently in the MST
  24. timezone, which is also known as GMT -0700, add seven hours to the local
  25. time.</para>
  26. <para><command>systemd-timedated</command> reads <filename>/etc/adjtime</filename>,
  27. and depending on the contents of the file, sets the clock to either UTC or
  28. local time.</para>
  29. <para>Create the <filename>/etc/adjtime</filename> file with the following contents
  30. if your hardware clock is set to local time:</para>
  31. <screen><userinput>cat &gt; /etc/adjtime &lt;&lt; "EOF"
  32. <literal>0.0 0 0.0
  33. 0
  34. LOCAL</literal>
  35. EOF</userinput></screen>
  36. <para>If <filename>/etc/adjtime</filename> isn't present at first boot,
  37. <command>systemd-timedated</command> will assume that hardware clock is
  38. set to UTC and adjust the file according to that.</para>
  39. <para>You can also use the <command>timedatectl</command> utility to tell
  40. <command>systemd-timedated</command> if your hardware clock is set to
  41. UTC or local time:</para>
  42. <screen role="nodump"><userinput>timedatectl set-local-rtc 1</userinput></screen>
  43. <para><command>timedatectl</command> can also be used to change system time and
  44. time zone.</para>
  45. <para>To change your current system time, issue:</para>
  46. <screen role="nodump"><userinput>timedatectl set-time YYYY-MM-DD HH:MM:SS</userinput></screen>
  47. <para>The hardware clock will also be updated accordingly.</para>
  48. <para>To change your current time zone, issue:</para>
  49. <screen role="nodump"><userinput>timedatectl set-timezone TIMEZONE</userinput></screen>
  50. <para>You can get a list of available time zones by running:</para>
  51. <screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
  52. <note><para>Please note that the <command>timedatectl</command> command can
  53. be used only on a system booted with systemd.</para></note>
  54. <sect2>
  55. <title>Network Time Synchronization</title>
  56. <para>Starting with version 213, systemd ships a daemon called
  57. <command>systemd-timesyncd</command> which can be used to
  58. synchronize the system time with remote NTP servers.</para>
  59. <para>The daemon is not intended as a replacement for the well
  60. established NTP daemon, but as a client only implementation
  61. of the SNTP protocol which can be used for less advanced
  62. tasks and on resource limited systems.</para>
  63. <para>Starting with systemd version 216, the
  64. <command>systemd-timesyncd</command> daemon is enabled by
  65. default. If you want to disable it, issue the following
  66. command:</para>
  67. <screen role="nodump"><userinput>systemctl disable systemd-timesyncd</userinput></screen>
  68. <para>The <filename>/etc/systemd/timesyncd.conf</filename> file
  69. can be used to change the NTP servers that
  70. <command>systemd-timesyncd</command> synchronizes with.</para>
  71. <para>Please note that when system clock is set to Local Time,
  72. <command>systemd-timesyncd</command> won't update hardware
  73. clock.</para>
  74. </sect2>
  75. </sect1>