Windows Time Service Tools and Settings ·续1

Poll Interval: 6 (64s)

Phase Offset: -0.0000013s

ClockRate: 0.0156250s

State Machine: 2 (Sync)

Time Source Flags: 3 (Authenticated Hardware )

Server Role: 0 (None)

Last Sync Error: 0 (The command completed successfully.)

Time since Last Good Sync Time: 15.7344985s


In the output, the poll interval is listed in clock ticks and in seconds. The equations use the value measured in seconds (the value in parentheses).

The output lists the clock rate in seconds. To calculate the `SystemClockRate` value in clock ticks, use the following formula:

(`value in clock ticks`) = (`value in seconds`) × 1,000 × 10,000

This formula uses the following conversion factors:

- One second equals 1,000 milliseconds.

- One millisecond equals 10,000 clock ticks on a Windows system, as described in [DateTime.Ticks Property](/en-us/dotnet/api/system.datetime.ticks).

For example:

- If `SystemClockRate` is 0.0156250 seconds, the value that the equation produces is 156,250 clock ticks.

- By extension, five minutes becomes 5 × 60 × 1000 × 10000 = 3,000,000,000 clock ticks.

The following examples show how to apply the phase correction calculations for Windows Server 2012 R2 and earlier versions.

#### Example: The system clock rate is off by four minutes

If your computer clock time is 11:05 and the actual current time is 11:09, `w32tm` uses the following values:

- `PhaseCorrectRate` = 1

- `UpdateInterval` = 30,000 clock ticks

- `SystemClockRate` = 156,000 clock ticks

- `MaxAllowedPhaseOffset` = 10 min = 600 seconds = 600 × 1,000 × 10,000 = 6,000,000,000 clock ticks

- `CurrentTimeOffset` = 4 min = 4 × 60 × 1,000 × 10,000 = 2,400,000,000 clock ticks

To reset the clock, `w32tm` checks the following condition:

Is `CurrentTimeOffset` ≤ `MaxAllowedPhaseOffset`?

In this case, the condition has the following values, so it evaluates to true:

2,400,000,000 ≤ 6,000,000,000

Next, `w32tm` checks the following condition:

Is (CurrentTimeOffset) ÷ (PhaseCorrectRate × UpdateInterval) ≤ SystemClockRate ÷ 2?

In this case, the condition has the following values:

2,400,000,000 ÷ (30,000 × 1) ≤ 156,000 ÷ 2, or 80,000 ≤ 78,000

This condition is false. Therefore, `w32tm` sets the clock back immediately.

Note

In this example, if you want to set the clock back slowly, you also have to adjust the values of `PhaseCorrectRate` or `UpdateInterval` in the registry to make sure that the equation result is true.

#### Example: The system clock rate is off by three minutes

If your computer clock time is 11:05 and the actual current time is 11:08, `w32tm` uses the following values:

- `PhaseCorrectRate` = 1

- `UpdateInterval` = 30,000 clock ticks

- `SystemClockRate` = 156,000 clock ticks

- `MaxAllowedPhaseOffset` = 10 min = 600 seconds = 600 × 1,000 × 10,000 = 6,000,000,000 clock ticks

- `CurrentTimeOffset` = 3 mins = 3 × 60 × 1,000 × 10,000 = 1,800,000,000 clock ticks

To reset the clock, `w32tm` checks the following condition:

Is `CurrentTimeOffset` ≤ `MaxAllowedPhaseOffset`?

In this case, the condition has the following values, so it evaluates to true:

1,800,000,000 ≤ 6,000,000,000

Next, `w32tm` checks the following condition:

Is (CurrentTimeOffset) ÷ (PhaseCorrectRate × UpdateInterval) ≤ SystemClockRate ÷ 2?

In this case, the condition has the following values:

(1,800,000,000) ÷ (1 × 30,000) ≤ 156,000 ÷ 2, or 60,000 ≤ 78,000

This condition is true. The clock is set back slowly.

## Use Local Group Policy Editor

W32Time stores several configuration properties as registry entries. You can use Group Policy Objects (GPOs) in Local Group Policy Editor to configure most of this information. For example, you can use GPOs to configure a computer to be an NTP server or NTP client, configure the time synchronization mechanism, or configure a computer to be a reliable time source. You can also apply Group Policy settings for W32Time to domain controllers.

Windows stores W32Time policy information in the Local Group Policy Editor under **Computer Configuration\Administrative Templates\System\Windows Time Service**. It stores configuration information that the policies define in the Windows registry, and then uses those registry entries to configure the registry entries specific to W32Time. As a result, the values defined by Group Policy overwrite any preexisting values in the W32Time section of the registry. Some of the preset GPO settings differ from the corresponding default W32Time registry entries.

The following table lists the policies that you can configure for W32Time and registry subkey equivalents that those policies affect.

| Group Policy | Registry locations^1,^^2^ |

| --- | --- |

| Global Configuration Settings | W32TimeW32Time\ConfigW32Time\Parameters |

| Time Providers\Configure Windows NTP Client | W32Time\TimeProviders\NtpClient |

| Time Providers\Enable Windows NTP Client | W32Time\TimeProviders\NtpClient |

| Time Providers\Enable Windows NTP Server | W32Time\TimeProviders\NtpServer |

^1^ Subkey: `HKLM\SOFTWARE\Policies\Microsoft`^2^ Subkey: `HKLM\SYSTEM\CurrentControlSet\Services\W32Time`

Note

When you remove a Group Policy setting, Windows removes the corresponding entry from the policy area of the registry.

### GPO default settings for W32Time

The following table lists default values for the **Global Configuration Settings** when they're enabled:

| Group Policy setting | Default value |

| --- | --- |

| AnnounceFlags | 10 |

| ChainDisable | 0 |

| ChainEntryTimeout | 16 |

| ChainLoggingRate | 30 |

| ChainMaxEntries | 128 |

| ChainMaxHostEntries | 4 |

| ClockAdjustmentAuditLimit | 800 |

| ClockHoldoverPeriod | 7,800 |

| EventLogFlags | 2 |

| FrequencyCorrectRate | 4 |

| HoldPeriod | 5 |

| LargePhaseOffset | 50,000,000 |

| LocalClockDispersion | 10 |

| MaxAllowedPhaseOffset | 300 |

| MaxNegPhaseCorrection | 172,800 (48 hours) |

| MaxPollInterval | 10 |

| MaxPosPhaseCorrection | 172,800 (48 hours) |

| MinPollInterval | 6 |

| PhaseCorrectRate | 1 |

| PollAdjustFactor | 5 |

| RequireSecureTimeSyncRequests | 0 |

| SpikeWatchPeriod | 900 |

| UpdateInterval | 100 (1 second) |

| UtilizeSslTimeData | 1 |

### GPO settings for an NTP Client

The following table lists the default Windows NTP client settings that are contained in **Computer Configuration\Administrative Templates\System\Windows Time Service\Time Providers\Configure Windows NTP Client**.

| Group Policy setting | Default value |

| --- | --- |

| NtpServer | `time.windows.com`, 0x9 |

| Type | **NT5DS**: Used for domain-joined computers**NTP**: Used for non-domain-joined computers |

| CrossSiteSyncFlags | 2 |

| ResolvePeerBackoffMinutes | 15 |

| ResolvePeerBackoffMaxTimes | 7 |

| SpecialPollInterval | 1024 |

| EventLogFlags | 0 |

Note

If you use Group Policy to set the `NtpServer` value as part of the **Configure Windows NTP Client** policy and apply it to a domain member, W32Time doesn't use the `NtpServer` registry value. To view your NTP configuration, open Command Prompt and run the following command: `w32tm /query /configuration`.

## W32Time registry reference

W32Time stores information under the following registry paths:

```registry

HKLM\SYSTEM\CurrentControlSet\Services\W32Time

HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Config

HKLM\SYSTEM\CurrentControlSet\Services\W32Time\Parameters

HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient

HKLM\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer

Warning

This information is provided as a reference for use in troubleshooting and validation. Windows registry keys are used by W32Time to store critical information. Don't change these values. Modifications to the registry aren't validated by the registry editor or by Windows before they're applied. If the registry contains invalid values, Windows might experience unrecoverable errors.

Some of the parameters in the registry are measured in clock ticks and some are measured in seconds. To convert between the two units, see the explanation earlier in Configure a computer clock reset.

In the following table, All versions refers to all supported versions of Windows and Windows Server.

Config

| Registry entry | Versions | Description |

| --- | --- | --- |

| AnnounceFlags | All versions | Controls whether this computer is marked as a reliable time server. A computer isn't marked as reliable unless it's also marked as a time server.<br>- 0x00: Not time server<br>- 0x01: Always time server<br>- 0x02: Automatic time server<br>- 0x04: Always-reliable time server<br>- 0x08: Automatic reliable time server<br><br><br>The default value for domain members is 10. The default value for stand-alone clients and servers is 10. |

| ClockAdjustmentAuditLimit | Windows Server 2016 version 1709 and later versions; Windows 10 version 1709 and later versions | Specifies the smallest local clock adjustments that can be logged to the W32Time event log on the target computer. The default value is 800 parts per million (ppm). |

| ClockHoldoverPeriod | Windows Server 2016 version 1709 and later versions; Windows 10 version 1709 and later versions | Indicates the maximum number of seconds a system clock can nominally hold its accuracy without synchronizing with a time source. If this period of time passes without W32Time obtaining new samples from any of its input providers, W32Time initiates a rediscovery of time sources. The default value is 7,800 seconds. |

| EventLogFlags | All versions | Controls which events the time service logs.<br>- 0x1: Time jump<br>- 0x2: Source change<br><br><br>The default value on domain members is 2. The default value on stand-alone clients and servers is 2. |

| FrequencyCorrectRate | All versions | Controls the rate at which the clock is corrected. If this value is too small, the clock is unstable and overcorrects. If the value is too large, the clock takes a long time to synchronize. The default value on domain members is 4. The default value on stand-alone clients and servers is 4.<br>Zero isn't a valid value for the FrequencyCorrectRate registry entry. |

| HoldPeriod | All versions | Controls the period of time for which spike detection is disabled in order to bring the local clock into synchronization quickly. A spike is a time sample indicating that time is off several seconds, and is received after good time samples return consistently. The default value on domain members is 5. The default value on stand-alone clients and servers is 5. |

| LargePhaseOffset | All versions | Specifies that a time offset greater than or equal to this value in 10^-7^ seconds is considered a spike. A network disruption such as a large amount of traffic might cause a spike. A spike is ignored unless it persists for a long period of time. The default value on domain members is 50,000,000. The default value on stand-alone clients and servers is 50,000,000. |

| LocalClockDispersion | All versions | Controls the dispersion (in seconds) that you must assume when the only time source is the built-in CMOS clock. The default value on domain members is 10. The default value on stand-alone clients and servers is 10. |

| MaxAllowedPhaseOffset | All versions | Specifies the maximum offset (in seconds) for which W32Time attempts to adjust the computer clock by using the clock rate. When the offset exceeds this rate, W32Time sets the computer clock directly. The default value for domain members is 300. The default value for stand-alone clients and servers is 1. |

| MaxClockRate | All versions | Maintained by W32Time. It contains reserved data that's used by the Windows operating system, and any changes to this setting can cause unpredictable results. The default value for domain members is 155,860. The default value for stand-alone clients and servers is 155,860. |

| MaxNegPhaseCorrection | All versions | Specifies the largest negative time correction, in seconds, that the service makes. If the service determines that a change larger than this value is required, it logs an event instead.<br>The value 0xFFFFFFFF is a special case. This value means that the service always corrects the time.<br><br>The default value for domain members is 0xFFFFFFFF (hexadecimal). The default value for domain controllers is 172,800 (48 hrs). The default value for stand-alone clients and servers is 54,000 (15 hrs). |

| MaxPollInterval | All versions | Specifies the largest interval, in log base 2 seconds, allowed for the system polling interval. A system must poll according to the scheduled interval. A provider can refuse to produce samples when requested to do so. The default value for domain controllers is 10. The default value for domain members is 15. The default value for stand-alone clients and servers is 15. |

| MaxPosPhaseCorrection | All versions | Specifies the largest positive time correction in seconds that the service makes. If the service determines that a change larger than this value is required, it logs an event instead.<br>The value 0xFFFFFFFF is a special case. This value means that the service always corrects the time.<br><br>The default value for domain members is 0xFFFFFFFF (hexadecimal). The default value for domain controllers is 172,800 (48 hrs). The default value for stand-alone clients and servers is 54,000 (15 hrs). |

| MinClockRate | All versions | Maintained by W32Time. It contains reserved data that's used by the Windows operating system, and any changes to this setting can cause unpredictable results. The default value for domain members is 155,860. The default value for stand-alone clients and servers is 155,860. |

| MinPollInterval | All versions | Specifies the smallest interval, in log base 2 seconds, allowed for the system polling interval. A system doesn't request samples more frequently than this value. A provider can produce samples at times other than the scheduled interval. The default value for domain controllers is 6. The default value for domain members is 10. The default value for stand-alone clients and servers is 10. |

| PhaseCorrectRate | All versions | Controls the rate at which the phase error is corrected. Specifying a small value corrects the phase error quickly but might cause the clock to become unstable. If the value is too large, it takes a longer time to correct the phase error. <br>The default value on domain members is 1. The default value on stand-alone clients and servers is 7.<br><br>Zero isn't a valid value for the PhaseCorrectRate registry entry. |