The NetworkTimeProtocol class provides utility methods for working with NTP (Network Time Protocol) timestamps in PHP. It is part of the PHP WebRTC package and supports conversion between NTP timestamps and PHP DateTimeImmutable objects. Internally, it uses GMP to handle 64-bit fixed-point representations of time.
-
Convert current time to NTP timestamp (64-bit fixed-point)
-
Convert NTP timestamp to DateTimeImmutable
-
Accurate fractional second handling
-
Uses GMP for high-precision arithmetic
-
Fully UTC-compliant
- PHP ≥ 8.4
This package is part of the PHP WebRTC library. For complete documentation, examples, and API reference, visit:
-
Amin Yazdanpanah
- Website: aminyazdanpanah.com
- Email: github@aminyazdanpanah.com
-
Sana Moniri
- GtiHub: sanamoniri
Found a bug? Please report it on our issues.
BSD 3-Clause License. See LICENSE for details.