# 时钟同步

**时钟同步**（clock synchronization）是使彼此独立的设备、计算机或网络节点的时钟相互对齐的过程，使它们在规定的精度内读取相同的时间，或与协调世界时（UTC）等共同基准保持一个已知的偏差。它是带时间戳的交易、工业测量与控制、电信切换、电网保护以及分布式系统中事件排序的基础。<sup>[1](https://technav.ieee.org/topic/synchronization/)</sup>

| 关键事实 | 说明 |
|---|---|
| 参考时间 | 协调世界时（UTC），以国际原子时（TAI）为基础，并通过闰秒加以调整；目前两者相差 37 秒，TAI 领先于 UTC<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup> |
| 闰秒 | 自 1972 年 6 月 30 日起插入，用以将 UTC 与随地球自转变化的天文时标 UT1 的偏差保持在 ±0.9 秒以内<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup> |
| NTP 精度 | 广域网上标称 10 至 50 毫秒；在局域网内使用 GPS 时间源时约为 1 毫秒<sup>[3](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7184.pdf)</sup> |
| PTP 精度 | 在局域网中于网络接口处进行硬件时间戳标记，可达亚微秒级<sup>[1](https://technav.ieee.org/topic/synchronization/)</sup> |
| 亚纳秒级传递 | 欧洲核子研究中心（CERN）的“白兔”（White Rabbit）将同步以太网（SyncE）与 PTP 结合，并对时延与不对称性进行实测，实现亚纳秒级时间传递<sup>[4](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.1500-203.pdf)</sup> |
| 数据库时间 | 谷歌 Spanner（Google Spanner）的 TrueTime 借助 GPS 接收机与原子钟，将时钟不确定度在 99 百分位下保持在 1 毫秒以内<sup>[5](https://cloud.google.com/blog/products/databases/strict-serializability-and-external-consistency-in-spanner)</sup> |
| 安全标准 | 网络时间安全（Network Time Security，RFC 8915，2020 年 9 月）为 NTP 客户端—服务器模式增加了基于 TLS 的认证与加密<sup>[6](https://datatracker.ietf.org/doc/html/rfc8915)</sup> |

## 时标与参考基准问题

同步需要一个共同的“现在”定义。UTC 是通用授时的标准：它以国际原子时（TAI）为基础，其秒由原子跃迁定义，但通过闰秒加以调整，使其在地球自转变化的情况下仍与太阳和恒星的视位置保持一致。<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup> 第一个闰秒于 1972 年 6 月 30 日插入，迄今为止所有闰秒均为正闰秒，即插入一个额外的秒，使该日依次经过 23 时 59 分 59 秒、23 时 59 分 60 秒，然后到 00 时 00 分 00 秒。<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup> 标准中也规定，若地球自转的变化将来需要，可以引入负闰秒。<sup>[7](https://www.nist.gov/pml/time-and-frequency-division/leap-seconds-faqs)</sup>

在两次闰秒之间，UT1 与 UTC 之间的微小偏差以 DUT1 修正量的形式公布，该值由国际计量局（Bureau International des Poids et Mesures）给出，并由美国国家标准与技术研究院（NIST）的 WWV、WWVH、WWVB 无线电台以及自动计算机时间服务以 0.1 秒的分辨率播发。<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup> 2026 年初，NIST 根据美国海军天文台（United States Naval Observatory）的数据公布的每周 UT1-UTC 值约为 70 至 75 毫秒。<sup>[2](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)</sup>

## 网络时间协议

**NTP** 是互联网上历史最悠久、部署最广泛的同步协议。版本 0 于 1985 年实现，首个正式规范为 RFC 958；版本 1 见 RFC 1059，版本 2 于 1989 年发表于 RFC 1119，其中引入了 NTP 控制报文协议和对称密钥加密认证。<sup>[8](https://www.ntp.org/reflib/papers/history.pdf)</sup> 当前规范 NTP 版本 4 为 RFC 5905（2010 年 6 月），描述了用于同步分布式时间服务器与客户端的体系结构、状态机和算法，并废止了版本 3 与 SNTP 的规范。<sup>[9](https://www.rfc-editor.org/info/rfc5905/)</sup>

NTP 采用以 UTC 为源时间的层级式客户端—服务器模型。0 至 16 的层级（stratum）记录了一台时钟距离一级源有多远：第 0 层是原子钟或 GPS 接收机，第 1 层服务器是其直接客户端，充当时间服务器；同一层级的时钟可以进行对等同步（peer），用于交叉校验和冗余备份。时间通过 UDP/IP 以单播、组播或广播方式分发，默认端口为 123。<sup>[3](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7184.pdf)</sup> 其线上协议采用往返时延设计，只依赖实测的时钟偏差，不要求报文可靠送达；同步子网是一个自组织的主从层级结构，即使存在多台一级服务器也无需选举协议。<sup>[10](https://datatracker.ietf.org/doc/html/rfc5905)</sup>

精度取决于网络和源时钟。NIST 2004 年的一项评估认为，NTP 在广域网上的标称性能为 10 至 50 毫秒，若在局域网内以 GPS 作为时间源，则可提高到约 1 毫秒。<sup>[3](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7184.pdf)</sup> 实现质量同样重要：在 chrony 项目所做的模拟比较中，在网络抖动为 10 微秒、时钟稳定的条件下，chrony 的平均偏差为 35 ± 8 微秒，而 ntp 为 234 ± 46 微秒，openntpd 为 857 ± 226 微秒；在连接时断时续、时钟频率突变的情况下，chrony 的表现也更好。<sup>[11](https://chrony-project.org/comparison.html)</sup>

## 精确时间协议（IEEE 1588）

**IEEE 1588** 的协议即精确时间协议（PTP），它面向的是空间范围比一般互联网更局限、且需要在低成本设备上以最少的管理开销获得更高精度的测量与控制系统。<sup>[12](https://www.nist.gov/el/intelligent-systems-division-73500/introduction-ieee-1588)</sup> 其源头可追溯到 1994 年 NIST 的一次传感器网络通信会议；2001 年成立了标准化委员会，IEEE 于 2001 年 6 月 18 日批准了该申请，标准于 2002 年 11 月发布。此后修订为 IEEE 1588-2008，业界称为版本 2；IEEE 1588-2019 于 2019 年 12 月获批，并由国际电工委员会（IEC）采纳为 IEC 61588:2021。<sup>[12](https://www.nist.gov/el/intelligent-systems-division-73500/introduction-ieee-1588)</sup>

PTP 通过在网络接口处用硬件打时间戳，消除了软件协议栈的时延，从而在局域网中达到亚微秒级精度。<sup>[1](https://technav.ieee.org/topic/synchronization/)</sup> 1588 系统的时间尺度由其主时钟（grandmaster）定义，主时钟通常是一个驱动计数器的晶体振荡器；若主时钟被设置为 UTC 并受 GPS 等高质量源驯服，整个系统便跟踪 UTC；反之，一个未受驯服的晶体即使能让 1588 时钟之间的相对同步保持精确，自身每天也可能漂移零点几秒。<sup>[13](https://www.nist.gov/el/intelligent-systems-division-73500/utc-source-1588)</sup> 该标准的配置文件（profile）机制允许各应用领域自行定制协议；电信领域的配置文件遵循 ITU-T 规范，广播媒体使用 SMPTE ST 2059-2 配置文件，金融交易网络则将 IEEE 802.1AS 局域网组网与电信组网混用。<sup>[14](https://sagroups.ieee.org/1588/news/ieee-1588-2019-evolves-to-better-serve-its-wide-variety-of-applications/)</sup><sup> • </sup><sup>[15](https://psecommunity.org/wp-content/plugins/wpor/includes/file/2303/LAPSE-2023.19728-1v1.pdf)</sup>

对于最严苛的要求，同步以太网（SyncE）与 PTP 结合，可将网内所有振荡器锁定到主时钟的频率上，并沿路径布置边界时钟和透明时钟；欧洲核子研究中心（CERN）的“白兔”变体在此基础上加入对设备时延与不对称性的实测修正，从而实现亚纳秒级时间传递，IEEE 1588 的高精度选项也吸收了其中部分技术。<sup>[4](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.1500-203.pdf)</sup>

## 分布式系统中的逻辑时钟

物理同步并不总是可行或足够的，因此分布式系统还使用逻辑时钟，在不参照实际时间（wall time）的情况下为事件定序。主要的算法包括兰波特算法（Lamport's algorithm）、里卡特—阿格拉瓦拉算法（Ricart-Agrawala algorithm）、向量时钟（vector clocks）和克里斯蒂安算法（Cristian's algorithm）。<sup>[16](https://arxiv.org/abs/2404.15467)</sup>

数据库将两种方法结合起来。谷歌 Spanner 的 TrueTime API 返回的是一个时间区间而非单一时间值，其不确定度由有界的时钟漂移和网络往返时间计算得出；在托管的 Spanner 环境中，时间服务器与实体的 GPS 接收机和原子钟同步，不确定度在 99 百分位下保持在 1 毫秒以内。Spanner 通过“提交等待”（commit wait）实现外部一致性，即推迟事务的提交，直到其时间戳确定已成为过去。<sup>[5](https://cloud.google.com/blog/products/databases/strict-serializability-and-external-consistency-in-spanner)</sup><sup> • </sup><sup>[17](https://docs.cloud.google.com/spanner-omni/true-time-external-consistency)</sup>

## 安全

时间协议本身就是攻击面。在标准配置下，NTP 在不加保护的情况下交换报文，中间人因此可以丢弃、重放或篡改这些报文；NTP 控制报文还能把小查询放大成大响应，这一点已被用于分布式拒绝服务攻击。<sup>[18](https://www.rfc-editor.org/rfc/rfc8633.html)</sup> RFC 8915（2020 年 9 月）规定的网络时间安全（Network Time Security）为 NTP 客户端—服务器模式增加了密码学保护：用传输层安全（TLS）协议建立密钥，并对时间报文本身采用带关联数据的认证加密。<sup>[6](https://datatracker.ietf.org/doc/html/rfc8915)</sup> 即便是经过认证的协议，仍然会受制于报文时延操纵，现行最佳实践文件所述的各种 NTP 安全措施都无法防范这一点。<sup>[18](https://www.rfc-editor.org/rfc/rfc8633.html)</sup> 针对 IEEE 1588 的研究同样表明，操作系统的漏洞可以在绕过现有 PTP 安全扩展的情况下，悄无声息地破坏 PTP 同步的稳定性。<sup>[19](https://arxiv.org/abs/2510.06421)</sup>

## References

1. [Synchronization, IEEE Technology Navigator](https://technav.ieee.org/topic/synchronization/)
2. [Leap Second and UT1-UTC Information, NIST Time and Frequency Division](https://www.nist.gov/pml/time-and-frequency-division/time-realization/leap-seconds)
3. [NISTIR 7184, Time Synchronization in Networked Systems (2004)](https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7184.pdf)
4. [NIST Special Publication 1500-203, Framework for Cyber-Physical Systems: Volume 3, Timing Annex](https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.1500-203.pdf)
5. [Strict Serializability and External Consistency in Spanner, Google Cloud Blog](https://cloud.google.com/blog/products/databases/strict-serializability-and-external-consistency-in-spanner)
6. [RFC 8915: Network Time Security for the Network Time Protocol, IETF (September 2020)](https://datatracker.ietf.org/doc/html/rfc8915)
7. [Leap Seconds FAQs, NIST](https://www.nist.gov/pml/time-and-frequency-division/leap-seconds-faqs)
8. [A Brief History of NTP and its Future, NTP Reference Library (Mills)](https://www.ntp.org/reflib/papers/history.pdf)
9. [RFC 5905: Network Time Protocol Version 4, RFC Editor (June 2010)](https://www.rfc-editor.org/info/rfc5905/)
10. [RFC 5905 full text, IETF Datatracker](https://datatracker.ietf.org/doc/html/rfc5905)
11. [Comparison of NTP implementations, chrony project](https://chrony-project.org/comparison.html)
12. [Introduction to IEEE 1588, NIST Intelligent Systems Division](https://www.nist.gov/el/intelligent-systems-division-73500/introduction-ieee-1588)
13. [UTC Source 1588, NIST Intelligent Systems Division](https://www.nist.gov/el/intelligent-systems-division-73500/utc-source-1588)
14. [IEEE 1588-2019 Evolves to Better Serve its Wide Variety of Applications, IEEE 1588 Working Group](https://sagroups.ieee.org/1588/news/ieee-1588-2019-evolves-to-better-serve-its-wide-variety-of-applications/)
15. [Recent Advances in Precision Clock Synchronization Protocols for Power Grid Control Systems, LAPSE (2023)](https://psecommunity.org/wp-content/plugins/wpor/includes/file/2303/LAPSE-2023.19728-1v1.pdf)
16. [A Review on Message Complexity of the Algorithms for Clock Synchronization in Distributed Systems, arXiv](https://arxiv.org/abs/2404.15467)
17. [TrueTime and External Consistency, Google Cloud Documentation](https://docs.cloud.google.com/spanner-omni/true-time-external-consistency)
18. [RFC 8633: Network Time Protocol Best Current Practices, IETF (July 2019)](https://www.rfc-editor.org/rfc/rfc8633.html)
19. [Breaking Precision Time: OS Vulnerability Exploits Against IEEE 1588, arXiv](https://arxiv.org/abs/2510.06421)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Sep 30, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 物质世界与数学 › 测量与时间 › 计时与时间标准 › Time standards, precision, and technical time › Clock synchronization and technical time overview

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/clock-synchronization

English original: https://www.edgepedia.org/clock-synchronization
