Fix WSL time drift

There is a bug in WSL2 that causes the clock inside the VM to drift behind the actual clock on the machine.

This can lead to many unexpected issues, ranging from harmless (git commit messages having old timestamps) to severe (SSL connection failures).

We can sync the VM clock using the command

Terminal window
sudo hwclock -s

We can also add the command as a cron job every 5-10 minutes to make sure that the clock doesn’t drift too far back.

This work is licensed under CC BY-NC-SA 4.0. Copying is an act of love — please copy!