首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Windows时间服务不会同步

Windows时间服务不会同步
EN

Stack Overflow用户
提问于 2021-04-28 09:07:59
回答 2查看 1.7K关注 0票数 2

我在这里发布我的问题,因为即使我可以阅读所有的文章来修复这个问题,w32tm在尝试将计算机时间与本地NTP服务器(这是一个可编程控制器)同步时仍然会给出相同的错误消息。

以下是对这种情况的快速解释:

我们有一个PC安装了一个“Windows10 IoT企业2019年”映像,必须与客户的时钟同步。

我们正在尝试使用w32tm (Windows服务),因为它必须通过控制台命令进行参数化,而控制台命令将通过网页进行接口。

每次我们尝试制作w32tm /resync时,都会出现以下错误:即使使用/force或/nowait参数,“计算机没有重新同步,因为没有可用的时间数据”。

如果我们检查此服务的日志,我们会发现这个错误似乎删除了接收到的数据包:

数据包测试6失败(上次同步后没有同步或间隔不好)。-忽略172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123)."中测试失败的数据包

我可以平平PLC,如果我们使用一个使用他自己的服务而不是Windows时间的外部同步工具,它就能很好地工作(但正如前面所解释的,我们必须将这个NTP设置与控制台命令连接起来,所以这不是一个好的最终解决方案)。

我们使用Wireshark读取PLC和PC之间的所有数据包交换。问题是,根据所使用的工具(w32tm或外部工具),数据包是相同的。这始终是相同的数据包内容与正确的时间戳使用等.

以下是我尝试过的多种解决方案:

检查Windows的组策略的configured"

  • ->它们都在上,而不是

  • 防火墙没有阻塞任何NTP数据包(端口123)

  • 执行了所有这些命令:

net stop w32time w32tm /unregister reg添加启用/t reg_dword /d0 w32tm /register net start w32time w32tm /config/manualpeerlist:"172.28.134.229,0x8“/同步标志:手动/可靠:是/更新w32tm /resync网停止w32time w32tm /config/manualpeerlist:172.28.134.229,0x8

我尝试了所有的标志"0x1,0x4,0x8,0x9“,甚至删除了引号。

我也试过:

w32tm /config /syncfromflags:domhier /update

w32tm /resync

我检查了寄存器(regedit)的参数,它们被设置为具有正确IP地址的NTP。

我也尝试了NT5DS和"NoSync“,但没有成功。

这里是用w32tm /query命令读取的配置:

代码语言:javascript
运行
复制
C:\Windows\system32>w32tm.exe /config /syncfromflags:manual /manualpeerlist:172.28.134.229,0x8 /reliable:yes /update
The command completed successfully.


C:\Windows\system32>w32tm /query /peers
#Peers: 1

Peer: 172.28.134.229,0x8
State: Active
Time Remaining: 990.8006238s
Mode: 3 (Client)
Stratum: 0 (unspecified)
PeerPoll Interval: 0 (unspecified)
HostPoll Interval: 10 (1024s)


C:\Windows\system32>w32tm /query /status
Leap Indicator: 0(no warning)
Stratum: 1 (primary reference - syncd by radio clock)
Precision: -23 (119.209ns per tick)
Root Delay: 0.0000000s
Root Dispersion: 10.0000000s
ReferenceId: 0x4C4F434C (source name:  "LOCL")
Last Successful Sync Time: 23/04/2021 13:59:08
Source: Local CMOS Clock
Poll Interval: 10 (1024s)


C:\Windows\system32>w32tm /query /configuration
[Configuration]

EventLogFlags: 2 (Local)
AnnounceFlags: 5 (Local)
TimeJumpAuditOffset: 28800 (Local)
MinPollInterval: 10 (Local)
MaxPollInterval: 15 (Local)
MaxNegPhaseCorrection: 54000 (Local)
MaxPosPhaseCorrection: 54000 (Local)
MaxAllowedPhaseOffset: 1 (Local)

FrequencyCorrectRate: 4 (Local)
PollAdjustFactor: 5 (Local)
LargePhaseOffset: 50000000 (Local)
SpikeWatchPeriod: 900 (Local)
LocalClockDispersion: 10 (Local)
HoldPeriod: 5 (Local)
PhaseCorrectRate: 1 (Local)
UpdateInterval: 360000 (Local)


[TimeProviders]

NtpClient (Local)
DllName: C:\Windows\SYSTEM32\w32time.DLL (Local)
Enabled: 1 (Local)
InputProvider: 1 (Local)
AllowNonstandardModeCombinations: 1 (Local)
ResolvePeerBackoffMinutes: 15 (Local)
ResolvePeerBackoffMaxTimes: 7 (Local)
CompatibilityFlags: 2147483648 (Local)
EventLogFlags: 1 (Local)
LargeSampleSkew: 3 (Local)
SpecialPollInterval: 32768 (Local)
Type: NTP (Local)
NtpServer: 172.28.134.229,0x8 (Local)

NtpServer (Local)
DllName: C:\Windows\SYSTEM32\w32time.DLL (Local)
Enabled: 0 (Local)
InputProvider: 0 (Local)



C:\Windows\system32>w32tm /resync
Sending resync command to local computer
The computer did not resync because no time data was available.

,这里是w32tm :的日志

代码语言:javascript
运行
复制
153514 12:12:08.7993597s - | OriginateTimestamp:   0xE42D3818CB35B91F - 13263653528793788500ns - 153514 12:12:08.7937885s
153514 12:12:08.7993921s - | ReceiveTimestamp:     0xE42D3819170A3D70 - 13263653529090000000ns - 153514 12:12:09.0900000s
153514 12:12:08.7994267s - | TransmitTimestamp:    0xE42D3819170A3D70 - 13263653529090000000ns - 153514 12:12:09.0900000s
153514 12:12:08.7994635s - >-- Non-packet info:
153514 12:12:08.7994818s - | DestinationTimestamp: 153514 12:12:08.7994963s - 0xE42D3818CBCBBA7E153514 12:12:08.7995103s -  - 13263653528796077400ns153514 12:12:08.7995263s -  - 153514 12:12:08.7960774s
153514 12:12:08.7995467s - | RoundtripDelay: 2288900ns (0s)
153514 12:12:08.7995746s - | LocalClockOffset: 295067000ns - 0:00.295067000s
153514 12:12:08.8015152s - \--
153514 12:12:08.8020609s - ListeningThread STC:717682
153514 12:12:08.8021869s - Packet test 6 failed (not syncd or bad interval since last sync).
153514 12:12:08.8022403s - Ignoring packet that failed tests from 172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123).
153514 12:12:23.2930188s - W32TmServiceMain: timeout
153514 12:12:23.2937795s - Sample Prepared at 132636535432937200 for peer 172.28.134.229,0x8 (ntp.m|0x8|0.0.0.0:123->172.28.134.229:123)
153514 12:12:23.2938670s - ** NTP sample vector is empty.
153514 12:12:23.2939470s - No new NTP sample is available.
153514 12:12:23.2940151s - UpdateTimerQueue1: TN:112282810000::: LRT:104334530000  LUT:112122810000 LAFLTNS:160000000 TSLGT:160006702 LTNS:864000000000
153514 12:12:23.2940663s - W32TmServiceMain: waiting 1024.000s
153514 12:12:23.2941588s - Triggering re-read of configuration
153514 12:12:23.2950225s - RPC Call - Query Status
153514 12:12:23.2950599s - W32TmServiceMain: Param change notification
153514 12:12:23.2951580s - RPC Call - Query Configuration
153514 12:12:23.2952419s - RPC Call - Query Provider Configuration
153514 12:12:23.2952967s - TimeProvCommand([NtpClient], TPC_Query) called.
153514 12:12:23.2953598s - RPC Call - Query Provider Configuration
153514 12:12:23.2960078s - ReadConfig: Found provider 'NtpClient':
153514 12:12:23.2972157s - ReadConfig:   'InputProvider'=0x00000001
153514 12:12:23.2973229s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2973894s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2974384s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2974854s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2975555s - ReadConfig: Found provider 'NtpServer':
153514 12:12:23.2976585s - ReadConfig:   'InputProvider'=0x00000000
153514 12:12:23.2977217s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2977861s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2978341s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2978805s - ReadConfig:   'DllName'='C:\Windows\SYSTEM32\w32time.DLL'
153514 12:12:23.2979806s - ReadConfig: Found provider 'VMICTimeProvider':
153514 12:12:23.2980822s - ReadConfig:   'InputProvider'=0x00000001
153514 12:12:23.2981444s - ReadConfig:   'MetaDataProvider'=0x00000000
153514 12:12:23.2982194s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2984498s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2985230s - ReadConfig:   'DllName'='C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.2988793s - ReadConfig: 'PhaseCorrectRate'=0x00000001 (2)
153514 12:12:23.2989981s - ReadConfig: 'UpdateInterval'=0x00057E40 (2)
153514 12:12:23.2990612s - ReadConfig: 'FrequencyCorrectRate'=0x00000004 (2)
153514 12:12:23.2991230s - ReadConfig: 'PollAdjustFactor'=0x00000005 (2)
153514 12:12:23.2991877s - ReadConfig: 'LargePhaseOffset'=0x02FAF080 (2)
153514 12:12:23.2992474s - ReadConfig: 'SpikeWatchPeriod'=0x00000384 (2)
153514 12:12:23.2993069s - ReadConfig: 'HoldPeriod'=0x00000005 (2)
153514 12:12:23.2993674s - ReadConfig: 'MinPollInterval'=0x0000000A (2)
153514 12:12:23.2994285s - ReadConfig: 'MaxPollInterval'=0x0000000F (2)
153514 12:12:23.2994909s - ReadConfig: 'ClockHoldoverPeriod'=0x0000C350 (2)
153514 12:12:23.2995529s - ReadConfig: 'AnnounceFlags'=0x00000005 (2)
153514 12:12:23.2996139s - ReadConfig: 'LocalClockDispersion'=0x0000000A (2)
153514 12:12:23.2996766s - ReadConfig: 'MaxNegPhaseCorrection'=0x0000D2F0 (2)
153514 12:12:23.2997412s - ReadConfig: 'MaxPosPhaseCorrection'=0x0000D2F0 (2)
153514 12:12:23.2998337s - ReadConfig: 'EventLogFlags'=0x00000002 (2)
153514 12:12:23.2998984s - ReadConfig: 'MaxAllowedPhaseOffset'=0x00000001 (2)
153514 12:12:23.2999717s - ReadConfig: 'UtilizeSslTimeData'=0x00000001 (2)
153514 12:12:23.3000346s - ReadConfig: 'ClockAdjustmentAuditLimit'=0x00000320 (2)
153514 12:12:23.3000988s - ReadConfig: 'TimeJumpAuditOffset'=0x00007080 (2)
153514 12:12:23.3001792s - Clock adjustment info: dwCurrentSecPerTick: 156250 dwDefaultSecPerTick: 156250 bSyncToCmosDisabled:1
153514 12:12:23.3002293s - PerfFreq:10000000c/s
153514 12:12:23.3002816s - currAdj:10000000 Incr:10000000 IncrEnabled:1
153514 12:12:23.3017975s -   No params changed for local clock.
153514 12:12:23.3018766s - /--TimeProvider: new enabled provider list
153514 12:12:23.3019546s - | Name:NtpClient, Started:0, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3020198s - | Name:VMICTimeProvider, Started:0, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\System32\vmictimeprovider.dll
153514 12:12:23.3020668s - >--
153514 12:12:23.3021157s - | Total:2, Input: 2, Marked: 0
153514 12:12:23.3021618s - \--
153514 12:12:23.3022097s - /--TimeProvider: Parameter change before list is updated
153514 12:12:23.3022637s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3023098s - >--
153514 12:12:23.3023578s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3024034s - \--
153514 12:12:23.3024507s - /--TimeProvider: new disabled provider list
153514 12:12:23.3025036s - | Name:NtpServer, Started:0, Input:0, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3025495s - >--
153514 12:12:23.3025973s - | Total:1, Input: 0, Marked: 0
153514 12:12:23.3026427s - \--
153514 12:12:23.3026901s - /--TimeProvider: Parameter change before list is updated
153514 12:12:23.3027435s - | Name:NtpServer, Started:0, Input:0, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3027910s - >--
153514 12:12:23.3028391s - | Total:1, Input: 0, Marked: 0
153514 12:12:23.3028853s - \--
153514 12:12:23.3029456s - TimeProvCommand([NtpClient], TPC_UpdateConfig) called.
153514 12:12:23.3035085s - ReadConfig: 'AllowNonstandardModeCombinations'=0x00000001 (2)
153514 12:12:23.3035803s - ReadConfig: 'CompatibilityFlags'=0x80000000 (2)
153514 12:12:23.3036445s - ReadConfig: 'SpecialPollInterval'=0x00008000 (2)
153514 12:12:23.3037071s - ReadConfig: 'ResolvePeerBackoffMinutes'=0x0000000F (2)
153514 12:12:23.3037693s - ReadConfig: 'ResolvePeerBackoffMaxTimes'=0x00000007 (2)
153514 12:12:23.3038323s - ReadConfig: 'EventLogFlags'=0x00000001 (2)
153514 12:12:23.3038952s - ReadConfig: 'LargeSampleSkew'=0x00000003 (2)
153514 12:12:23.3039722s - ReadConfig: 'SignatureAuthAllowed'=0x00000001 (2)
153514 12:12:23.3040458s - ReadConfig: 'Type'=NTP (2)
153514 12:12:23.3041173s - ReadConfig: 'NtpServer'=172.28.134.229,0x8 (2)
153514 12:12:23.3042074s - ReadConfig: 'ManualPeerList'(parsed)='172.28.134.229,0x8'
153514 12:12:23.3042832s - ReadConfig: 'MinPollInterval'=0x0000000A (2)
153514 12:12:23.3043476s - ReadConfig: 'MaxPollInterval'=0x0000000F (2)
153514 12:12:23.3043993s - Poll interval settings: MinPollInterval:10 MaxPollInterval:15
153514 12:12:23.3044728s - NTP client telemetry enabled: 0
153514 12:12:23.3049786s -   ManualPeerListUpdate: add:0 del:0 noch:1
153514 12:12:23.3055288s - StartListeningThread completed!
153514 12:12:23.3056254s - PeerPollingThread: waiting 497.492s
153514 12:12:23.3056982s - StartPeerPollingThread completed!
153514 12:12:23.3062014s - Starting 'VMICTimeProvider', dll:'C:\Windows\System32\vmictimeprovider.dll'
153514 12:12:23.3199766s - LoadLibrary
153514 12:12:23.3201254s - Logging Info: Time provider 'VMICTimeProvider' indicated that the current operating environment is unsupported and has stopped. This is expected for VMIC provider in non-Hyperv environments. This may be the expected behavior for the current provider in the current operating environment as well. error:-2147024846
153514 12:12:23.3242933s - Discarding provider 'VMICTimeProvider'.
153514 12:12:23.3243877s - RemoveProviderFromList: VMICTimeProvider
153514 12:12:23.3244382s - /--TimeProvider: Provider list after the provider is actually removed
153514 12:12:23.3244921s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3245383s - >--
153514 12:12:23.3245879s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3246336s - \--
153514 12:12:23.3246865s -   Provider list: 0 stopped, 0 started, 1 not changed.
153514 12:12:23.3247354s - /--TimeProvider: Parameter change after list is updated
153514 12:12:23.3247893s - | Name:NtpClient, Started:1, Input:1, Marked:0, RefCount:0, DllName:C:\Windows\SYSTEM32\w32time.DLL
153514 12:12:23.3248543s - >--
153514 12:12:23.3249166s - | Total:1, Input: 1, Marked: 0
153514 12:12:23.3249733s - \--
153514 12:12:23.3250806s - RPC Call - Query Configuration
153514 12:12:23.3252165s - RPC Call - Query Provider Configuration
153514 12:12:23.3252760s - TimeProvCommand([NtpClient], TPC_Query) called.
153514 12:12:23.3253381s - RPC Call - Query Provider Configuration
153514 12:12:23.3255358s - UpdateTimerQueue1: TN:112283120000::: LRT:104334530000  LUT:112122810000 LAFLTNS:160021737 TSLGT:160021737 LTNS:864000000000
153514 12:12:23.3255909s - W32TmServiceMain: waiting 1023.998s

自从几个星期以来,我一直在努力解决这个问题,你知道如何解决这个问题吗?

这是一个非常重要的功能,这个应用程序,我们不能提供给客户,如果这不起作用。

谢谢您的答复。

诚挚的问候。

EN

回答 2

Stack Overflow用户

发布于 2022-07-10 13:12:20

在命令块中,“这里是用w32tm /query命令读取的配置:”w32tm /query /status命令返回的行之一是:

Source: Local CMOS Clock

这意味着您的操作系统没有使用时间服务。它从内置的cmos时钟中获取日期和时间。

我建议:

代码语言:javascript
运行
复制
w32tm.exe /config /update /manualpeerlist:"time1.google.com time2.google.com time3.google.com time4.google.com" /syncfromflags:manual

sc.exe stop w32time 

sc.exe start w32time

w32tm.exe /resync
票数 0
EN

Stack Overflow用户

发布于 2022-08-18 00:55:32

最简单的解决方案是安装pool.ntp.org。

手动通过以下命令推荐安装pool.ntp.org时间服务器:

代码语言:javascript
运行
复制
w32tm /config /update /manualpeerlist:"0.pool.ntp.org,0x8 1.pool.ntp.org,0x8 2.pool.ntp.org,0x8 3.pool.ntp.org,0x8" /syncfromflags:MANUAL

您可以在这里找到其他信息:https://support.ntp.org/bin/view/Support/WindowsTimeService

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67297163

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档