Sometimes the system clock in WSL2 can get out of sync with the actual time / hardware clock. Particularly after sleep or hibernate
By adding this to your .bashrc, you can keep your WSL2 instance up to date w/o needing to invoke sudo hwclock -s
, scheduling tasks, or otherwise
This is terrible and you probably shouldn't use this.
This is still a terrible workaround that we shouldn't use, BUT the WSL CLI for executing arbitrary commands has changed a bit, so line 6 should be either
wsl.exe -u root hwclock -s
.