Time Synchronization

Time synchronization.

Why is this not automated already?

It kind of is, but it often fails, and also fails to sync with enough accuracy.

I teach online and our calls always cut off 10-20 seconds sooner than the in-call countdown timer.

When comparing the system clock with an online clock (one that uses their server's computer time instead of my computer's clock), I found it to be 10+ seconds off! This is ridiculous.

Clock.zone, “a website where you can find real exact time.”

“This clock shows time from our dedicated server synchronised with atomic clock.”

The "sync now" button in Windows Settings just doesn't seem to do the job properly. There are various possible reasons for this, but if it works sometimes, I really don't care about those reasons. It's a computer, it should keep trying to sync the time until it succeeds. Instead, my calls — timed by the second — are consistently inconsistent.

How to synchronize the system clock manually

Windows has a setting in the Control Panel for synchronizing to any time server you like, and already has two options included. You can choose what you like, as some time servers may be blocked in your country or region, or by your .

To find this, go to:

Windows Settings → Time & language → Date & time → Additional clocks

Click "Additional clocks"
Choose the "Internet Time" tab, then click "Change settings..."
Select or paste your chosen time server URL, then click "Update now".

Select or paste your chosen time server address into the server text box, then click "Update now" and wait for a few moments. If it fails, click it a few more times, and if it still fails, find a new time server. You can also check if the URL is alive by using a terminal/CMD app to ping the server:

ping time.nist.gov 

And there you have it!

If it worked, now your clock should be accurate to within a second, hopefully within a few milliseconds.

Here's a screenshot comparing the real-time clock website with my system clock:

You can see that they are near-enough identical.


Automating time synchronization

Ok, now to automate this synchronization task.

Windows should already do this, but apparently it does not.

Let's explore Task Scheduler.

Task Scheduler is an incredibly powerful automation tool, it can be triggered by thousands of system event hooks so you can automatically run any command for practically any event.

Search online to find out more about Task Scheduler and all that you can do with it!

How to do it:

Task Scheduler → "Action" menu → Create Basic Task

Create Basic Task

Add a name as you like. Add a description if you want.

Tell it to start when the computer starts — or whenever you want.

Tell it that you want to start a program.

Type w32tm in the Program box, and /resync in the Add arguments box.

Check the summary on the Finish page.

Tick the checkbox for "Open the Properties dialog for this task when I click Finish",

then click Finish.

General tab

When the Properties dialog opens, set it to:

  • Run whether user is logged on or not

  • Run with highest privileges

  • Configure for: Windows 10

Triggers tab

Change to the Triggers tab and click New to add a new trigger.

Set:

  • Log: Microsoft-Windows-NetworkProfile/Operational

  • Source: NetworkProfile

  • Event ID: 10000

  • Delay task for: 30 seconds

  • Enabled

Press OK to close the window.

Conditions tab

Change to the Conditions tab.

Set "Start only if the following network connection is available" to "Any connection", or a specific network of your choice.

Settings tab

Finally, check the Settings tab.

  • Allow task to be run on demand

  • If the task fails, restart every: 1 minute

  • Stop if the task runs longer than: 1 hour

  • If the running task does not end when requested, force it to stop

Press OK to close the window.

A window will pop up, asking for your account password. It will save this and won't ask you again, unless you checked the "Do not store password" box on the General tab.

Your time synchronization task is complete!

Sources I used

Last updated