Post by J. P. GilliverWhen I select "Adjust date/time" from the clock menu, I get the "Date
and Time" window, with three tabs; if I select the "Internet Time" one,
I am told "This computer is set to automatically synchronize with" a
time server. There's also a "Change settings..." button.
I clicked that button, expecting to be able to change the server and the
interval. I get a window containing: a tickbox to turn syncing on and
off altogether; a drop-down list of servers (I vaguely remember a post
or something telling me how to modify that list); and an "Update now"
button. It also tells me "The clock was successfully synchronised with
<timeserver> on 2023-12-17 at 19:00."
That was when I clicked "Update now" just now; it obviously _hadn't_
been doing so (it had been more or less a minute slow), despite (a)
"This computer is set to automatically ..." and (b) the time server
selected must still work (otherwise it wouldn't have "successfully
synchronised" when I told it to. (It did - it advanced by the minute -
as well as _telling_ me it had.
1. Why isn't it, despite (a) the "Synchronise ..." button being ticked,
and (b) a valid time server being in the box?
2. Where do I set the interval?
(No, I don't want to install a third-party utility: my mail/news suite
will do that if I start it with admin. privileges, but why isn't/how do
I set the interval in the mechanism that's part of the OS?)
If you pick a very busy NTP server, you might not synchronize for a
while. Your competing with all other Windows users on a limited
resource. Lots of users don't touch this setting, so the vast majority
of hosts are trying to use time.windows.com server. Pick one not so
busy. Even changing to the pre-configured time.nist.org server would be
less busy giving you a better chance to sync. There is only 1 chance
per NTP update request to get updated. There's no pending or retrying.
To change the list of NTP servers, edit the registry at:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DateTime\Servers
You'll see numerical key names, like 1, 2, 3, etc. Add another key
name, like 4, and specify the NTP server. Then go back into Internet
time settings to pick the one you just added.
time.nist.org is less busy than time.windows.com. However, I use
us.pool.ntp.org (I'm in the USA) which load balances across various
regions (zones) to get you to an NTP server. For more info, see
https://www.ntppool.org/en/use.html. They have continental zones
(europe, north america, oceania, and asia). For me, I would pick the
north-america zone, drill down into the united states pool. For you,
pick whatever zone is yours, and drill down to however far they give you
within that zone.
If you don't want to use the ntp.org's NTP pool, your local university
probably runs their own own stratum 2 NTP server. Public NTP servers
are mostly stratum 3, but gov't or educational servers may be at stratum
2.
https://safran-navigation-timing.com/manuals/SS/Content/_Global/Topics/NTP/NTP_Stratums.htm
https://en.wikipedia.org/wiki/Network_Time_Protocol#Clock_strata
You can find online lists of NTP servers, like this one for stratum 2
NTP servers:
https://www.advtimesync.com/docs/manual/stratum2.html
Many lists don't tell you the strata. They omit that info, or they
don't know (like they crowd-source their database). What you have to
ensure is that the NTP server is publicly accessible. Some are not,
especially those that peer to other NTP servers in the same stratum.
Check if your university has public NTP servers. I used my university's
NTP servers (they have 2 of them, so I picked the 2nd one) until I
discovered the ntp.org pools.
Windows is configured to update the system clock about once per week, or
when you log into your Windows account (but that might only be for
domain members - those that login into a PDC). To change the update
interval, edit the registry at:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config
and change the UpdateInterval data item's value. Mine is set to 360000
(decimal) which is the default for stand-alone clients (workstations).
It's 100 for domain controllers, and 30000 for domain members. The
value is in seconds, so 360000 seconds is about 4.2 days. Too long for
me, so I figured out how to sync more often. I could reduce the
registry value, too, but I'm leery an update would reset it, plus I
prefer scheduling an NTP update rather than having to edit the registry
any time I want to change the default update interval.
If you want to immediately do an NTP sync, but use the command line
instead of drilling through GUI wizard, run the w32tm program.
https://learn.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings
I added the following event in Task Scheduler to do a time sync every
time I login:
w32tm /resync /nowait
Actually, that is in a batch file (timesync.bat) that runs:
net start w32time
w32tm /resync /nowait
No point in trying to do a time sync unless the w32time service is
running. 'net start' is asynchronous: just because the 'net' command
exits doesn't mean the service got into Running mode. So, it's possible
the w32tm program runs before the w32time service gets started and is
running, but after a few times of running the batch file the service
will be running. I would have to add code in the batch file that polls
the service using sc.exe to see when it got into Running status, but I
figure one, or two, mishaps is not a problem since I run the scheduled
event on the following triggers: at a time each day (I chose 12:05 AM),
on system startup, on workstation unlock of any user.
I can run the batch file manually should I want to. The w32tm program
requires you run it in an elevanted command shell. If I directly ran
the .bat file as an event in Task Scheduler, I'd see the command shell
open and close which can be distracting while also stealing focus away
from the window were I was currently working. So, in Task Scheduler,
the command I use is:
Program: cmd.exe
Arguments: /c start /min c:\batch\timesync.bat
The task is configured to run with highest privileges. I load the
command shell and use start and /min to minimize the console window to
just a taskbar button. That will show a taskbar button that flashes on
and off, and often so fast that I don't notice it. There are other
means of loading a program without a window, but I don't want to get
into scripting for such a simple task.
When Windows is running, it does not get time from the RTC logic on the
mobo. It uses its own system clock. If you run CPU intensive tasks,
like video editing, Prime95, or other high-CPU processes, the system
clock will drift. Typically I leave my desktop PC running 24x7;
however, the scheduled event makes sure that an NTP sync is performed
every day both by a scheduled time, and because my computer gets locked
using the screen saver (so I have to unlock to use which is a trigger to
run the time sync event). When the computer is powered off, the 3-volt
CMOS coin cell battery supplies power to the RTC logic (to keep time
when powered off). When Windows starts, it gets its time from RTC, but
thereafter uses its own code for its system clock, and why high CPU
usage can make the system clock drift.
I don't know what is your behavior regardling leaving the computer
always powered on, what processes you run regarding sustained high CPU
usage, or if you power off the computer when not in use. Might be time
to consider how old is the CMOS coin cell batter in your computer. For
a desktop (tower), replacing the battery is easy. For laptops, and
unless a backside cover panel was provided, you have to dismantle the
laptop to replace the battery. For a notebook (since those are often
ultrasonically welded together), you'll have to cut open the case after
finding out where is the battery (which may be soldered instead of in a
slide-in holder). Batteries are chemical: they'll die no matter how
well you care for them. How old is yours? After 5 years, time to
replace the battery.