WSL2 date time skew error

WSL2 (including with Windows 20H1 2004) is known to have issues with having the WSL clock get hours or days behind actual time after the computer is suspended. This issue was not seen in WSL1, but upon upgrading to WSL2 has been almost immediately apparent to multiple people that reported this issue. This causes errors with build systems (including GNU Make and Ninja) and SSL verification among others.

Workaround

A workaround for this, when it occurs (have to keep doing workaround) is to synchronize the software clock to the onboard hardware clock from WSL Terminal:

sudo hwclock -s

or if suitable from Windows Terminal:

wsl --shutdown

If that doesn’t work, try using NTP from WSL Terminal:

ntpdate time.windows.com

Reference

This issue has been noted at WSL GitHub Issues:

Other issues are linked from those