I have WSL Ubuntu 20.4 LTS installed on Windows 11 with all the latest updates. I noticed my Git commit times being as much as 24 hours off and realized that the date/time in WSL drifts out of time.
I can get it to sync up temporarily by running the following command in WSL window: sudo ntpdate time.windows.com
So I thought my solution would be to run sudo crontab -e
and set up a cron job to run that command every 15 minutes. Well, it doesn't work. I can only run the command manually, seems like nothing in cron actually executes (maybe because the date time is off?)
Obviously it is a pain in the butt to run this command constantly. I need either a solution or a workaround. I know how to program, so any ideas would be appreciated. I'm willing to write a script or whatever so my clock can stay synced! Thanks!
PS - there is strangely no tag for WSL or Windows Subsystem for Linux