Dealing with Windows 7 Time Sync issues

For reasons (I suspect the CMOS battery, but have no replacements), the clock on my Windows 7 PC ceased working correctly. On boot, the time is very close to the time the computer was last shut down, which is often greater than 12hrs behind. It does not automatically pick up the correct time.

I initially thought that this was because there are limits to the maximum time difference when syncing, so that if the clock is too far out the system time is not updated. I tried overriding these limits in the registry, however as the default sync only runs once a week this isn’t a complete fix. My temporary solution (until a new battery is obtained) is to also set up a resync Schedule Task for each boot.

Step 1. Overriding the registry sync limits

  1. Open Regedit.
  2. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config.
  3. Change MaxNegPhaseCorrection and MaxPosPhaseCorrection from d2f0 to ffffffff.
  4. Reboot.

Step 2. Setting up the Scheduled Task

  1. Open Task Scheduler.
  2. In the left panel find and highlight Task Scheduler (local) > Task Scheduler Library > Microsoft > Windows > Time Synchronization.
  3. In the Actions panel (right side) click Create Task….
  4. Enter a Name, e.g. Force sync time.
  5. Click Change User or Group….
  6. Click Advanced….
  7. Click Find Now.
  8. In the Search results list select LOCAL SERVICE., then click Ok and Ok.
  9. Tick Run with highest privileges.
  10. In Configure for select your operating system (why this doesn’t default to Windows 7 I don’t know).
  11. Activate the Triggers tab.
  12. Click New….
  13. Enter how often the Task should run. I set it to: At Startup with 1 minute delay. (I tried without a delay, and it seemed to try to update before the network was up and fail).
  14. Activate the Actions tab.
  15. Click New….
  16. Leave Action as Start a program.
  17. In Program/script enter %windir%\system32\sc.exe. In Add arguments enter start w32time task_started. This ensures the Windows time sync service is running.
  18. Click Ok.
  19. Click New… again, but this time enter a new Start a program with Program/script of %windir%\system32\w32tm.exe with and argument /resync. This synchronises the time.
  20. Activate the Conditions tab.
  21. Tick Start only if the following network connection is available, and leave it set to Any connection (as you need a network connection to synchronise the time). Optionally you can also untick the 1st Power option, as the Task won’t use much  power when using battery.
  22. Activate the Settings tab.
  23. Tick Run task as soon as possible after a scheduled start is missed.
  24. Click Ok.

You can now test the Task by clicking Run. If you clock time was incorrect, it should now be correct.

If the clock issue is that it loses time while running, this could indicate more than a battery problem. A quick fix would be to set up a Scheduled Task as above, but set it to run constantly such as every 15 min.

Undoing the changes

You can easily undo the changes above, by setting the Registry values back to the original values and deleting the Scheduled Task.

Leave a Reply

Your email address will not be published. Required fields are marked *