Ubuntuシステム変更時間

3437 ワード

新しいubuntuでは、timedatectlntpdateに置き換えて時間管理を行います.
1.現在のタイム・ステータスの表示
現在のタイム・ステータスtimedatectl statusを表示します.
wxs@ubuntu:~/6-1/task4$ timedatectl status
      Local time: Tue 2017-11-07 18:14:30 PST
  Universal time: Wed 2017-11-08 02:14:30 UTC
        RTC time: Wed 2017-11-08 02:14:29
       Time zone: America/Los_Angeles (PST, -0800)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

システムに表示される時間はエラーであり、エラーの原因も明らかであり、America/LOS_を使用しています.Angelesのタイムゾーン.
そのため、タイムゾーンを修正すれば、時間の正確さを保証することができます.
2.タイムゾーンの変更
すべてのタイムゾーン名は/usr/share/zoneinfoファイルに格納されます.
命令timedatectl set-timezone "Asia/Shanghai"を実行すれば、タイムゾーンを上海タイムゾーンに設定することができます.
==== AUTHENTICATING FOR org.freedesktop.timedate1.set-timezone ===
Authentication is required to set the system timezone.
Authenticating as: wxs,,, (wxs)
Password: 
==== AUTHENTICATION COMPLETE ===

現在のタイム・ステータスtimedatectl statusを再表示します.
wxs@ubuntu:~/6-1/task4$ timedatectl status
      Local time: Wed 2017-11-08 10:15:45 CST
  Universal time: Wed 2017-11-08 02:15:45 UTC
        RTC time: Wed 2017-11-08 02:15:45
       Time zone: Asia/Shanghai (CST, +0800)
 Network time on: yes
NTP synchronized: yes
 RTC in local TZ: no

この時はもう時間が正常になった.