July 10, 2022

RHEL 9.0 Managing Date, Time and Time Zone

$ sudo timedatectl 
               Local time: Sun 2022-07-10 18:27:46 CEST
           Universal time: Sun 2022-07-10 16:27:46 UTC
                 RTC time: Sun 2022-07-10 16:27:46
                Time zone: Europe/Stockholm (CEST, +0200)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

$ sudo timedatectl -h
timedatectl [OPTIONS...] COMMAND ...

Query or change system time and date settings.

Commands:
  status                   Show current time settings
  show                     Show properties of systemd-timedated
  set-time TIME            Set system time
  set-timezone ZONE        Set system time zone
  list-timezones           Show known time zones
  set-local-rtc BOOL       Control whether RTC is in local time
  set-ntp BOOL             Enable or disable network time synchronization

systemd-timesyncd Commands:
  timesync-status          Show status of systemd-timesyncd
  show-timesync            Show properties of systemd-timesyncd

Options:
  -h --help                Show this help message
     --version             Show package version
     --no-pager            Do not pipe output into a pager
     --no-ask-password     Do not prompt for password
  -H --host=[USER@]HOST    Operate on remote host
  -M --machine=CONTAINER   Operate on local container
     --adjust-system-clock Adjust system clock when changing local RTC mode
     --monitor             Monitor status of systemd-timesyncd
  -p --property=NAME       Show only properties by this name
  -a --all                 Show all properties, including empty ones
     --value               When showing properties, only print the value

See the timedatectl(1) man page for details.

$ sudo timedatectl list-timezones
$ sudo timedatectl set-ntp true
$ sudo chronyc sources -v

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^- ntp1.vmar.se                  2   7   377   114   +527us[ +527us] +/-   28ms
^- ec2-16-16-55-166.eu-nort>     2   7   377   116  -1587us[-1283us] +/-   43ms
^* time.cloudflare.com           3   7   377   115   +519us[ +823us] +/- 2212us
^- lul1.ntp.netnod.se            1   7   377   115  -3057us[-2753us] +/-   14ms

$ sudo cat /etc/chrony.conf
$ sudo man 5 chrony.conf
$ sudo systemctl status chronyd.service 
● chronyd.service - NTP client/server
     Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
...

No comments: