Windows 11 with WSL2 the WSL date and time does not sync

Heather Gray 51 Reputation points
2022-12-15T15:19:43.427+00:00

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

Windows for business | Windows Client for IT Pros | User experience | Other
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2022-12-15T15:29:27.85+00:00

    The product group for WSL actively monitors questions over at
    https://github.com/microsoft/WSL#readme
    https://stackoverflow.com/questions/tagged/windows-subsystem-for-linux?tab=Newest

    also this one may be of interest
    https://github.com/microsoft/WSL/issues/8204

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.