The simplest way I've found to keep your WSL2 clock in sync with your host clock.
Start WSL and add the following line to your ~/.bashrc file
# fix wsl time sync
sudo ntpdate ntp.ubuntu.com &>/dev/null &
This will sync your clock to the ubuntu ntp server (any ntp server will work)
the
&
on the end causes the command to run in the background so that your startup isn't delayed
Top comments (0)