timedatectl
時刻設定コマンド
CentOS 7 以降
現在のタイムゾーン表示
# timedatectl status Local time: 月 2019-02-18 09:34:46 JST Universal time: 月 2019-02-18 00:34:46 UTC RTC time: 月 2019-02-18 00:34:46 Time zone: Asia/Tokyo (JST, +0900) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
- NTP enabled
- NTP 時刻同期化有効
- NTP synchronized
- NTP 時刻同期化済み
- NTP enabled
Asia/Tokyo に合わせたい
# timedatectl set-timezone Asia/Tokyo
現在のタイムゾーンリスト
# timedatectl list-timezones
- RTC を OS の時刻に合わせる
現状の確認
# cat /etc/adjtime 0.0 0 0.0 0 UTC
変更
# timedatectl set-local-rtc 1
確認 1
# cat /etc/adjtime 0.0 0 0.0 0 LOCAL
確認 2
# timedatectl status Local time: 月 2019-02-18 09:38:07 JST Universal time: 月 2019-02-18 00:38:07 UTC RTC time: 月 2019-02-18 09:38:06 Time zone: Asia/Tokyo (JST, +0900) NTP enabled: yes NTP synchronized: yes RTC in local TZ: yes DST active: n/a Warning: The system is configured to read the RTC time in the local time zone. This mode can not be fully supported. It will create various problems with time zone changes and daylight saving time adjustments. The RTC time is never updated, it relies on external facilities to maintain it. If at all possible, use RTC in UTC by calling 'timedatectl set-local-rtc 0'.