Johnny Matthews | Reset WSL clock

I'm not sure why this keeps happening, but every now and again the clock within WSL (and WSL2) get massively out of sync. Here's how to reset it. This was written on 23rd of December 2022.
  1. Open WSL.

  2. Use hwclock -s to set the system clock from the hardware clock:

    sudo hwclock -s
    
  3. That’s it.

Update using NTPdate

For some reason, my Ubuntu clock gets out of sync with NTP servers on new installation. Here’s how to deal with that.

  1. Install ntpdate:

    sudo apt install ntpdate -y
    
  2. Update your system clock with ntpdate using the NIST time server:

    sudo ntpdate time.nist.gov
    
  3. You should be good now!