DEV Community

loading...

WSL2 Time Sync

bartr profile image Bart Robertson ・1 min read

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

Discussion (0)

pic
Editor guide