Force Time Synchronization hourly = Accurate Schedule starts
- JazJon
- Posts: 397
- Joined: Wed Jun 15, 2011 5:42 pm
- Location: San Francisco
- HTPC Specs:
Force Time Synchronization hourly = Accurate Schedule starts
EDIT: Below the line is my original post. The windows method is not reliable, servers failed yet again. (confirmed manually syncing produced error time out) my time was off a few minutes.
So in summary, I give up on the built in Windows time sync. I installed http://www.timesynctool.com/
Works great! More fail safe options, and nice logs. I recommend TimeSyncTool. (free open source too)
I disabled the Windows Time Sync in Task Scheduler below.
____________________________________________________
I wanted to share a tip on how to force windows to synchronize the clock of your PC more often. The default is like every month'ish or so, and you'll notice the start/stop time of scheduled recordings often drifts a few minute off in between. (losing the beginning of a show)
Here's how! (works great for me, I set it to happen every hour at x:54)
It works for both Windows 7 and Windows 8
http://www.ali-inc.com/technical/196-sy ... often.html
Force Windows time synchronization more often
Last week we discussed how to setup synchronization with an external time source. This week we will learn how to make the syncs occur more often.
Why is this important?
In different environments I’ve seen windows time drift by 1-2 minutes in a single day depending on hardware resources. Windows does not provide any user facing or GUI options to change the clock-sync frequency. By default it is set for once a week on Sunday night. The AD PDC controls time for the entire domain. This schedule should be added to the PDC of a domain. It can also be used to sync any Vista or Win 7 client not on a domain.
What NOT to do: The Synchronize Time task
Do not edit the registry or change the default sync task in Scheduled Tasks.
W32TM.EXE Tool
W32TM.EXE is a tool for troubleshooting windows time service. If you run W32TM.EXE with a /RESYNC argument it will trigger a clock sync. That is if the Windows Time Service is already running. If you want to test it make sure Windows Time service is started.
What to Do: Create a new Task
We will setup two tasks. The first ensures that the Windows Time service is available. The second then runs W32tm.exe /resync as often as you like
1. Open the "Task Scheduler"
2. Open the Microsoft / Windows / Time Synchronization tree and click "Create Task"
3. Give the task a new name. Mine is called "Sync Time"
4. Change the service to run under "LOCAL SERVICE" authority and check "run with highest privileges"
5. Change Configure for: to your Operating System
6. Choose the time you want the task to run each day. I have chosen 7:00AM each morning. (EDIT, I checked the box to repeat the task every hour at x:54)
7. The task will run two commands so order is important. The first command ensures Windows Time service is running the second causes a manual sync
Set the first action to start a program, which is %windir%\system32\sc.exe with argument start w32time task_started
Set the second action to start a program, which is %windir%\system32\w32tm.exe with argument /resync
8. You can check the status of the updates using the System Event Viewer. Look for events that reference the TIME SERVICE
____________________________________________________________________
P.S. The default server windows uses to change the time often times out. I have better results using the NIST servers (see below)
EDIT:
I exported the task I created above so it's easy to import for someone else or if I rebuild my PC from scratch (see attached)
The UserId will be wrong so either fix it manually in taskschedule after you import this, or edit it before hand.
So in summary, I give up on the built in Windows time sync. I installed http://www.timesynctool.com/
Works great! More fail safe options, and nice logs. I recommend TimeSyncTool. (free open source too)
I disabled the Windows Time Sync in Task Scheduler below.
____________________________________________________
I wanted to share a tip on how to force windows to synchronize the clock of your PC more often. The default is like every month'ish or so, and you'll notice the start/stop time of scheduled recordings often drifts a few minute off in between. (losing the beginning of a show)
Here's how! (works great for me, I set it to happen every hour at x:54)
It works for both Windows 7 and Windows 8
http://www.ali-inc.com/technical/196-sy ... often.html
Force Windows time synchronization more often
Last week we discussed how to setup synchronization with an external time source. This week we will learn how to make the syncs occur more often.
Why is this important?
In different environments I’ve seen windows time drift by 1-2 minutes in a single day depending on hardware resources. Windows does not provide any user facing or GUI options to change the clock-sync frequency. By default it is set for once a week on Sunday night. The AD PDC controls time for the entire domain. This schedule should be added to the PDC of a domain. It can also be used to sync any Vista or Win 7 client not on a domain.
What NOT to do: The Synchronize Time task
Do not edit the registry or change the default sync task in Scheduled Tasks.
W32TM.EXE Tool
W32TM.EXE is a tool for troubleshooting windows time service. If you run W32TM.EXE with a /RESYNC argument it will trigger a clock sync. That is if the Windows Time Service is already running. If you want to test it make sure Windows Time service is started.
What to Do: Create a new Task
We will setup two tasks. The first ensures that the Windows Time service is available. The second then runs W32tm.exe /resync as often as you like
1. Open the "Task Scheduler"
2. Open the Microsoft / Windows / Time Synchronization tree and click "Create Task"
3. Give the task a new name. Mine is called "Sync Time"
4. Change the service to run under "LOCAL SERVICE" authority and check "run with highest privileges"
5. Change Configure for: to your Operating System
6. Choose the time you want the task to run each day. I have chosen 7:00AM each morning. (EDIT, I checked the box to repeat the task every hour at x:54)
7. The task will run two commands so order is important. The first command ensures Windows Time service is running the second causes a manual sync
Set the first action to start a program, which is %windir%\system32\sc.exe with argument start w32time task_started
Set the second action to start a program, which is %windir%\system32\w32tm.exe with argument /resync
8. You can check the status of the updates using the System Event Viewer. Look for events that reference the TIME SERVICE
____________________________________________________________________
P.S. The default server windows uses to change the time often times out. I have better results using the NIST servers (see below)
EDIT:
I exported the task I created above so it's easy to import for someone else or if I rebuild my PC from scratch (see attached)
The UserId will be wrong so either fix it manually in taskschedule after you import this, or edit it before hand.
- Attachments
-
- Sync Time.zip
- Time Sync.xml
- (1.11 KiB) Downloaded 431 times
Last edited by JazJon on Sat May 11, 2013 6:06 am, edited 3 times in total.
-
- Posts: 1761
- Joined: Fri Sep 07, 2012 3:43 pm
- Location:
- HTPC Specs:
You can also use the time servers that people vounteer through ntp.org.
The following command sets the Windows Time Service up to synchronize against a group of NTP servers, and ntp.org uses round robin DNS to share those requests out among over 700 NTP servers in the US. If you are based somewhere else in the world, you should replace .us with your own country code, so that you use an NTP server that's closer to you, and therefore should give a faster response.
w32tm /config /syncfromflags:manual /manualpeerlist:0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org
See http://www.ntp.org for more information.
The following command sets the Windows Time Service up to synchronize against a group of NTP servers, and ntp.org uses round robin DNS to share those requests out among over 700 NTP servers in the US. If you are based somewhere else in the world, you should replace .us with your own country code, so that you use an NTP server that's closer to you, and therefore should give a faster response.
w32tm /config /syncfromflags:manual /manualpeerlist:0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org
See http://www.ntp.org for more information.
- mcewinter
- Posts: 999
- Joined: Thu Jun 30, 2011 8:33 pm
- Location: Chicago
- HTPC Specs:
I don't think servers are the problem. Windows tends to refuse to sync the time. I use the method JazJon posted and it's quite reliable.
- JazJon
- Posts: 397
- Joined: Wed Jun 15, 2011 5:42 pm
- Location: San Francisco
- HTPC Specs:
My new Mac Mini was drifting as much as 3 minutes per hour at times. (can't figure it out) The hourly sync at x:54 seems to be working perfectly long term so far. If I notice it's not working even longer term, I'm going to guess I got flagged from the sync server I'm using for requesting the time update too often. (but so far so good) I'll add the pool method foxwood talked about if needed.
- STC
- Posts: 6808
- Joined: Mon Jun 06, 2011 4:58 pm
- Location:
- HTPC Specs:
Most probably the cause is a dodgy quartz crystal oscillator.JazJon wrote:My new Mac Mini was drifting as much as 3 minutes per hour at times. (can't figure it out)
By the Community, for the Community. 100% Commercial Free.
Want decent guide data back? Check out EPG123
Want decent guide data back? Check out EPG123
-
- Posts: 1761
- Joined: Fri Sep 07, 2012 3:43 pm
- Location:
- HTPC Specs:
Time.windows.com often fails to respond - I'm pretty sure it's a server problem, not a Windows issue, because I don't see those failures using other servers.mcewinter wrote:I don't think servers are the problem. Windows tends to refuse to sync the time. I use the method JazJon posted and it's quite reliable.
- holidayboy
- Posts: 2840
- Joined: Sun Jun 05, 2011 1:44 pm
- Location: Northants, UK
- HTPC Specs:
Either that or the dilithium matrix needs to be re-initialised.STC wrote: Most probably the cause is a dodgy quartz crystal oscillator.
Rob.
TGB.tv - the one stop shop for the more discerning Media Center user.
TGB.tv - the one stop shop for the more discerning Media Center user.
- STC
- Posts: 6808
- Joined: Mon Jun 06, 2011 4:58 pm
- Location:
- HTPC Specs:
I knew you'd do that!
"She canny tek it nooo longerrrrrr!"
I am being serious with the comment though.
All electronic 'clocks' have the crystal set in a tiny housing that oscillates to a set frequency and performs the supposedly accurate counting function for laptops and PC's (for instance) to keep the time. this is why the coin cell battery is required to power the counting mechanism when the main device is powered down.
"She canny tek it nooo longerrrrrr!"
I am being serious with the comment though.
All electronic 'clocks' have the crystal set in a tiny housing that oscillates to a set frequency and performs the supposedly accurate counting function for laptops and PC's (for instance) to keep the time. this is why the coin cell battery is required to power the counting mechanism when the main device is powered down.
By the Community, for the Community. 100% Commercial Free.
Want decent guide data back? Check out EPG123
Want decent guide data back? Check out EPG123
- holidayboy
- Posts: 2840
- Joined: Sun Jun 05, 2011 1:44 pm
- Location: Northants, UK
- HTPC Specs:
Kind of like one of those magical jumping beans then
Rob.
TGB.tv - the one stop shop for the more discerning Media Center user.
TGB.tv - the one stop shop for the more discerning Media Center user.
-
- Posts: 5738
- Joined: Tue Jun 21, 2011 7:23 pm
- Location: Titusville, Florida, USA
- HTPC Specs:
The frequency at which a crystal oscillates varies with temperature. As you can imagine, it's impossible to make a PC's clock 100% accurate because the oscillator is located inside the case. It heats up gradually when you turn on the PC, then cools down when you turn it off. If the crystal oscillator was located outside the case, it would be easier to make it accurate.
- mcewinter
- Posts: 999
- Joined: Thu Jun 30, 2011 8:33 pm
- Location: Chicago
- HTPC Specs:
From what I understand, the real issue is the frequency in which Windows actually updates the time. I've never really had issues reaching out to time servers, at least not permanantly.foxwood wrote:Time.windows.com often fails to respond - I'm pretty sure it's a server problem, not a Windows issue, because I don't see those failures using other servers.mcewinter wrote:I don't think servers are the problem. Windows tends to refuse to sync the time. I use the method JazJon posted and it's quite reliable.
http://www.pretentiousname.com/timesync/index.html
-
- Posts: 1761
- Joined: Fri Sep 07, 2012 3:43 pm
- Location:
- HTPC Specs:
When I'm asked to check out a PC or laptop for a friend, I'll usually check the time sync as I go through and update various things. I frequently see an error when I try to force a sync against time.windows.com, which is what they all default to. I'd never have even bothered looking for an alternative time source if that error wasn't so frequent.mcewinter wrote:From what I understand, the real issue is the frequency in which Windows actually updates the time. I've never really had issues reaching out to time servers, at least not permanantly.
I don't see that error when I check those machines again, after I've changed the Time server that they use. That leads me to believe that it's a problem with the time.windows.com servers, not with Windows itself.
- mcewinter
- Posts: 999
- Joined: Thu Jun 30, 2011 8:33 pm
- Location: Chicago
- HTPC Specs:
Nevertheless, the method mentioned above is what fixed my syncing issues. The obvious switching of servers had no effect.
-
- Posts: 5738
- Joined: Tue Jun 21, 2011 7:23 pm
- Location: Titusville, Florida, USA
- HTPC Specs:
It fixed mine too. Richard1980 posted about it more than a year ago. I set my scheduled task to trigger when the PC resumes from standby instead of hourly. Either way should would fine. The PC wakes 5 minutes before a recording is scheduled to begin, so it sync's the time right before starting a recording, and also whenever I wake it to watch TV.mcewinter wrote:Nevertheless, the method mentioned above is what fixed my syncing issues. The obvious switching of servers had no effect.
- JazJon
- Posts: 397
- Joined: Wed Jun 15, 2011 5:42 pm
- Location: San Francisco
- HTPC Specs:
Someone should write an app to make setup a breeze. Years ago the app Tardis used to be great. Looks like it hasn't been updated in many years though. I didn't search very hard but I'm sure some time sync app has to be out there that's x64 Win 8 compatible. (anyone?) I'm happy enough with the manual setup working, but I know I'll be annoyed with it's time to re-install windows at some point.
-
- Posts: 5738
- Joined: Tue Jun 21, 2011 7:23 pm
- Location: Titusville, Florida, USA
- HTPC Specs:
You can just export your scheduled task to an XML file. Zip it, and attach it to your first post in this thread. Then others can simply unzip it and import it into their task scheduler.JazJon wrote:Someone should write an app to make setup a breeze. Years ago the app Tardis used to be great. Looks like it hasn't been updated in many years though. I didn't search very hard but I'm sure some time sync app has to be out there that's x64 Win 8 compatible. (anyone?) I'm happy enough with the manual setup working, but I know I'll be annoyed with it's time to re-install windows at some point.
- JazJon
- Posts: 397
- Joined: Wed Jun 15, 2011 5:42 pm
- Location: San Francisco
- HTPC Specs:
Well I noticed my recordings were 4 minutes off today. I'm guessing my IP got black listed for hourly updates or the time server I waas using is just down today. I was using time-b.nist.govfoxwood wrote:You can also use the time servers that people vounteer through ntp.org.
The following command sets the Windows Time Service up to synchronize against a group of NTP servers, and ntp.org uses round robin DNS to share those requests out among over 700 NTP servers in the US. If you are based somewhere else in the world, you should replace .us with your own country code, so that you use an NTP server that's closer to you, and therefore should give a faster response.
w32tm /config /syncfromflags:manual /manualpeerlist:0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org
See http://www.ntp.org for more information.
Right click clock lower right, pick: Adjust Date/Time, pick: Internet Time (tab), click: Change settings (button)
So again, The server I had luck with for while was time-b.nist.org I tried a manual update and it timed out which explains why the scheduled task failed as well. I suspect my IP got black listed for hourly updates or they are down today. I changed to time-a.nist.gov and it's good again. I'd rather not have to mess with this every week so I'd like to use the time pool suggestion above.
I opened a command prompt above from an admin elevated command prompt. I ran: w32tm /config /syncfromflags:manual /manualpeerlist:0.us.pool.ntp.org,1.us.pool.ntp.org,2.us.pool.ntp.org,3.us.pool.ntp.org
It said The command completed successfully.
Are we supposed to see anything in the "Synchronize with an Internet time server" drop down menu that reflects these changes? I don't see anything new, maybe I need to reboot? (I'll edit my post if it shows up) Maybe it's never shown to us? (please clarify)
barnabas1969 wrote:You can just export your scheduled task to an XML file. Zip it, and attach it to your first post in this thread. Then others can simply unzip it and import it into their task scheduler.JazJon wrote:Someone should write an app to make setup a breeze. Years ago the app Tardis used to be great. Looks like it hasn't been updated in many years though. I didn't search very hard but I'm sure some time sync app has to be out there that's x64 Win 8 compatible. (anyone?) I'm happy enough with the manual setup working, but I know I'll be annoyed with it's time to re-install windows at some point.
Will do after I sort out the above
-
- Posts: 1761
- Joined: Fri Sep 07, 2012 3:43 pm
- Location:
- HTPC Specs:
I'd suggest that if your hardware is so flakey that you need to "fix" the time on an hourly basis, you should be looking for other problems!
You might want to see if you can get an NTP daemon running on a dd-wrt router, that hopefully will be more accurate than your PC, and can get by on daily updates, while your PC queries it on a hourly basis, though I really doubt that nist. gov are blacklisting you on the basis of 24 hits a day - the overhead of blacklisting you would be greater than the cost of responding to your queries.
As for whether you should see the list from the W32tm command in the GUI, probably not - it's a list of servers, and the GUI doesn't do lists. But I don't know off the top of my head the relationship between the different settings - you might want to see what's recorded in the eventvwr when time-syncing is going on.
You might want to see if you can get an NTP daemon running on a dd-wrt router, that hopefully will be more accurate than your PC, and can get by on daily updates, while your PC queries it on a hourly basis, though I really doubt that nist. gov are blacklisting you on the basis of 24 hits a day - the overhead of blacklisting you would be greater than the cost of responding to your queries.
As for whether you should see the list from the W32tm command in the GUI, probably not - it's a list of servers, and the GUI doesn't do lists. But I don't know off the top of my head the relationship between the different settings - you might want to see what's recorded in the eventvwr when time-syncing is going on.
- JazJon
- Posts: 397
- Joined: Wed Jun 15, 2011 5:42 pm
- Location: San Francisco
- HTPC Specs:
I'm not sure what to do hardware-wise. I'm using a new Apple MAC Mini i7. I've already swapped the hard drive for SSD so it's not possible to use warranty to swap it out very easy at this point. Worst case if another mini-PC i7 becomes available that is as good or better than the MAC Mini I'll buy that and sell the Mac Mini. (maybe something with HD 5000 graphics, an upgrade from my current HD 4000)foxwood wrote:I'd suggest that if your hardware is so flakey that you need to "fix" the time on an hourly basis, you should be looking for other problems!
You might want to see if you can get an NTP daemon running on a dd-wrt router, that hopefully will be more accurate than your PC, and can get by on daily updates, while your PC queries it on a hourly basis, though I really doubt that nist. gov are blacklisting you on the basis of 24 hits a day - the overhead of blacklisting you would be greater than the cost of responding to your queries.
As for whether you should see the list from the W32tm command in the GUI, probably not - it's a list of servers, and the GUI doesn't do lists. But I don't know off the top of my head the relationship between the different settings - you might want to see what's recorded in the eventvwr when time-syncing is going on.
I happen to have DD-WRT firmware on my Linksys router. Where can I find info on how to setup NTP daemon on it? Can I force windows to sync time against that every 10 minutes than instead? I'm assuming I'd use the gateway IP or something then, and some registry hack to get windows time sync to use it. (guessing)
I'll poke around the eventvwr