Configuring the Time Service: Max[Pos/Neg]PhaseCorrection

In the last few months of the Windows Server 2008 development, a good friend of mine was discussing a problem they have been seeing with customers. The problem, lovingly titled as the "Large Time Jump" issue involves a machine in the domain (usually the PDC) making a large jump in time, either forward or backwards. Regardless of the direction of the jump, the results are equally catastrophic.

How it all happens

Lets look at how this can happen. Some of the causes are more likely than you think. Here is a quick list:

  • Hardware changes. It is quite common for a company to have a hardware failure for a DC, even the PDC. Assume a situation where the motherboard in the PDC fails. After the hardware is all installed, the technician boots the machine back up. As hoped, the machine looks to be running just fine. However, the part that the manufacturer shipped out is considered an "after market" part, so the BIOS isn't configured correctly. By default, the BIOS date is set to the manufacture date of the motherboard - sometime in the past. Of course, when the technician gets the new part, he sees that everything looks to be in order, but he neglects to notice that the date it wrong.
  • Bad external time source. Sometimes, the time source that you are syncing the PDC with (such as a network device, like a high-end router) can get a wild hair and jump to an invalid time.
  • Bad CMOS battery. Every once in a while, a BIOS battery in a computer will fails. After all, they don't last forever. If the PDC isn't configured to sync with an external time source, it will by default use its own internal clock, which is based on the BIOS clock. A computer cannot maintain it's time across a reboot, so it stores the current time in the BIOS. If the CMOS battery has failed, the time after the reboot will be incorrect.
  • User error. It is not outside of the realm of possibility for someone to log onto the root PDC and change the clock. It sounds unlikely, but it is still possible.

Fixing the glitch

The real problem here is that in a domain environment, domain controller completely and utterly trust the time that they get from another DC. The root PDC is a special case, but it still counts.

The solution is to do a "sanity check" on the time that any domain controller gets from anywhere. In this way, you are ensuring that if a domain controller gets out of whack, it will not spread that time to other DCs. This is done by setting the MaxPosPhaseCorrection and MaxNegPhaseCorrection values.

MaxPosPhaseCorrection and MaxNegPhaseCorrection limit the allowable offset taken from a time sample. When any instance of w32time polls another machine for the time, it will determine the offset between the time source and itself. This value is known as the "Sample Offset". Before the samples is used by the time service, it will be compared to the phase correction limits. If the sample offset is greater than the phase correction limit, then sample will be thrown out and a "TOO BIG" event will be generated. The event contains all of the information about the time sample, including who sent it. The purpose of doing this is to isolate domain controllers in the network who get into a bad time state. In this way, the other DCs will log and error about the time samples being too big rather than blindly accepting it.

Knowing your limits

The next question is: What is an acceptable limit of phase correction? After much analysis and debate, we are advising a value of 48 hours. If a domain controller receives a sample that says it is more than 48 hours off, either in the future or in the past, the domain controller will throw it out. However, every customer should evaluate their own situation to be sure.

This is advised for both limits, both forward and backwards.

A packaged solution

Here is an example of a registry entry that you can merge on-demand to apply a 48 hour limit to the phase correction:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config]
"MaxNegPhaseCorrection"=dword:0002a300
"MaxPosPhaseCorrection"=dword:0002a300

As usual, If you have specific thoughts or questions about this post, please feel free to leave a comment. For general questions about w32time, especially if you have problems with your w32time setup, I encourage you to ask them on Directory Services section of the Microsoft Technet forums.

Comments

  • Anonymous
    February 28, 2008
    PingBack from http://www.biosensorab.org/2008/02/28/configuring-the-time-service-maxposnegphasecorrection/

  • Anonymous
    March 06, 2008
    When I set [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeConfig] to "MaxNegPhaseCorrection"=dword:0002a300 "MaxPosPhaseCorrection"=dword:0002a300 I expect a correct synchronization to occur if the NTP-server is less the 48 hour before or 48 hour after my clients clock. But I have: An error occured while windows was synchronizing with 192.168.0.6. The time sample was rejected because: The peer is not synchronized, or it has been too long since the peer's last synhchronization. Why doesn't my client synchronize?

  • Anonymous
    March 07, 2008
    This sounds more like a problem with the computer that you are synchronizing to than a problem with your local settings. You should check your time source to see that it is operating correctly. If you have any more questions, I would appriciate it if you could post them at here: http://forums.microsoft.com/TechNet/ShowForum.aspx?ForumID=571&SiteID=17

  • Anonymous
    March 09, 2008
    I really dont know whats the problem. My ntp-server was synchronized 2008-03-07 08:01 with time-c.timefreq.bldrdoc.gov My client was synchronized 2008-03-07 15:28 with my ntp-server. Now after 48 hours these clocks are more than 19 seconds away from eachother. I used stripchart, se below: C:>w32tm /stripchart /computer:192.168.0.6 tracking 192.168.0.6 [192.168.0.6]. the current time is 2008-03-09 17:10:45 (local time). 17:10:45 d:+00.0000000s o:+19.6238658s  [                           |                          @] Why is the clocks drifting?

  • Anonymous
    March 10, 2008
    marreoragarn, Please post your question on the technet forum at http://forums.microsoft.com/TechNet/ShowForum.aspx?ForumID=571&SiteID=17 and I will be happy to help you out.

  • Anonymous
    March 19, 2008
    In addition to a previous post a did, I would like to point you to a Microsoft blog about the Windows