NTP reader

0.2 2018-08-23 23:42 UTC

This package is auto-updated.

Last update: 2024-10-27 15:44:01 UTC


README

NTP reader

Build Status

Introduction

The NTP reader is a class for reading data from the NTP server over the UDP / TCP port. The class allows:

  • read data from the NTP server
  • transfer output data to the Carbon library for processing time

Installation

The recommended way to is via Composer:

composer require filipsedivy/ntp

It requires PHP version 7.1 and supports PHP up to 7.2.

Tests

To run the tests, you must run this command via Composer

composer test

Usage

$socket = FilipSedivy\NTP\Socket::create('europe.pool.ntp.org');
$datetime = FilipSedivy\NTP\Client::getDateTime($socket);

// Carbon library
echo $datetime->toDateTimeString();

// Alternatively DateTime functions
echo $datetime->format(...);