Timezone

From HPCWIKI
Revision as of 11:09, 30 May 2024 by Admin (talk | contribs) (Created page with " == Timezone set on Linux == Timezone tells your system where you are in the world depending on your exact location on this planet with GMT-/+<nowiki><time> format.</nowiki> On most Linux, <code>/etc/timezone</code> is a text-based representation of what timezone you are in. <code>/etc/localtime</code> is a binary representation of the exact rules for calculating the time relative to UNIX time by a symbolic link from <code>/etc/localtime</code> to a file in the <code...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Timezone set on Linux

Timezone tells your system where you are in the world depending on your exact location on this planet with GMT-/+<time> format.

On most Linux,

/etc/timezone is a text-based representation of what timezone you are in.

/etc/localtime is a binary representation of the exact rules for calculating the time relative to UNIX time by a symbolic link from /etc/localtime to a file in the /usr/share/zoneinfo directory.


instead of manually chaing those file, timedatectl command change your timezone much easily.

# Set system timezone to Asia/Seoul, for example.

$ sudo timedatectl set-timezone Asia/Seoul
$ ls -al /etc/timezone
-rw-r--r-- 1 root root 11 May 30 10:51 /etc/timezone

$ cat /etc/timezone
Asia/Seoul

$ ls -al /etc/localtime
lrwxrwxrwx 1 root root 32 May 30 10:51 /etc/localtime -> ../usr/share/zoneinfo/Asia/Seoul

systemd-timesyncd

systemd uses /etc/systemd/timesyncd.conf file for NTP time sync.

FallbackNTP points to the NTP servers, for example, FallbackNTP=time.nist.gov

# changing configuration file needs to restart systemd-timesyncd service
# timedatectl show-timesync command to verify current status.

#To enable the network time synchronization
%sudo timedatectl set-ntp true

#To disable the network time sync
$sudo timedatectl set-ntp false

References