DEV Community

Bart Robertson
Bart Robertson

Posted on

1 1

WSL2 Time Sync

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more