#author("2020-03-27T11:36:38+09:00","default:yakumo_murakami","yakumo_murakami")
[[パソコン汎用]]
LinuxとWindowsのマルチブート機で、切り替えると九時間ずれる問題ね。
これは、要は両者のOSでローカルタイムをどう扱っているか、なんですね。Linuxは世界協定時、Windowsは各地のローカルタイムで持っているので、ズレが出るわけ。
(それぞれのOS環境で、タイムサーバに問い合わせて時刻を訂正するので)
本来のグローバリズムだとWindows側で合わせたいけど、面倒を避けたいならLinux側であわせたいですよね?
ちなみに ''どちらかだけでいい'' です。両方やったら元の木阿弥です。
* Linux側で対応する [#p26e0a55]
以下はUbuntu16以降、Debian busterなどで有効よ。
$ timedatectl
Local time: 金 2020-03-27 12:21:30 JST
Universal time: 金 2020-03-27 03:21:30 UTC
RTC time: 金 2020-03-27 03:21:30
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no
$
はいダメ、RTC in local TZが no になってますね?
時間設定が間違ってないなら、以下で訂正しましょう。
$ sudo timedatectl set-local-rtc 1
[sudo] hachikun のパスワード:
$ timedatectl
Local time: 金 2020-03-27 12:22:00 JST
Universal time: 金 2020-03-27 03:22:00 UTC
RTC time: 金 2020-03-27 12:21:59
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
Warning: The system is configured to read the RTC time in the local time zone.
This mode cannot 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'.
$ sudo hwclock
2020-03-27 12:22:13.253503+09:00
$ timedatectl
Local time: 金 2020-03-27 11:22:25 JST
Universal time: 金 2020-03-27 02:22:25 UTC
RTC time: 金 2020-03-27 11:22:24
Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: yes
NTP service: active
RTC in local TZ: yes
Warning: The system is configured to read the RTC time in the local time zone.
This mode cannot 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'.
$
よしよし。
* Windows側で対応する [#k05f9d2f]
レジストリをいじる事になるかと。Windows10なら以下かな? regeditで、
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
に以下を代入。
RealTimeIsUniversal DWORD 1
……だそうです。(まだ試してない)