danog/php-rtc-ntp

Pure-PHP NTP timestamp conversion for WebRTC. MadelineProto's PHP 8.2+ fork fixes unsigned 64-bit handling and integrates with the modular danog/php-rtc stack.

Maintainers

Package info

github.com/danog/php-rtc-ntp

pkg:composer/danog/php-rtc-ntp

Transparency log

Fund package maintenance!

php-webrtc

Statistics

Installs: 56

Dependents: 3

Suggesters: 0

Stars: 0

Open Issues: 0

1.1.0 2026-08-25 18:48 UTC

README

PHP Version License

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.

About this fork

This is the danog/php-rtc-ntp fork used by MadelineProto. It targets PHP 8.2+, removes the GMP dependency, and correctly handles unsigned NTP values above PHP_INT_MAX using pure-PHP arithmetic.

All internal Composer dependencies use their danog/php-rtc-* package names directly, so installing a component selects the maintained danog packages throughout the dependency graph.

Features

  • Convert current time to NTP timestamp (64-bit fixed-point)

  • Convert NTP timestamp to DateTimeImmutable

  • Accurate fractional second handling

  • Handles unsigned 64-bit fixed-point values without GMP

  • Fully UTC-compliant

Requirements

  • PHP ≥ 8.2

Documentation

This package is part of the PHP WebRTC library. For complete documentation, examples, and API reference, visit:

PHP WebRTC Documentation

Credits

Authors

Reporting Issues

Found a bug? Please report it on our issues.

License

BSD 3-Clause License. See LICENSE for details.