WSL2でずれた時刻を修正する方法
WSL2でずれた時刻を修正するには--hctosysオプションを指定してhwclockコマンドを実行します。
実行例
$ date Mon Jan 4 07:47:28 JST 2021 $ sudo hwclock --hctosys $ date Mon Jan 4 10:34:17 JST 2021
オプション
$ hwclock --help Usage: hwclock [function] [option...] Time clocks utility. Functions: -r, --show display the RTC time --get display drift corrected RTC time --set set the RTC according to --date -s, --hctosys set the system time from the RTC -w, --systohc set the RTC from the system time --systz send timescale configurations to the kernel -a, --adjust adjust the RTC to account for systematic drift --predict predict the drifted RTC time according to --date Options: -u, --utc the RTC timescale is UTC -l, --localtime the RTC timescale is Local -f, --rtc use an alternate file to /dev/rtc0 --directisa use the ISA bus instead of /dev/rtc0 access --date