定制 bt51/ntp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

bt51/ntp

最新稳定版本:0.1.0

Composer 安装命令:

composer require bt51/ntp

包简介

PHP library for interacting with ntp servers

README 文档

README

Package ntp is a simple NTP client. It supports NTP version 4 and SNTP. Note that this client currently does not take network delay into account. This means the time that is received will not be accurate to the nanosecond.

Installation

Create a composer.json in your project

{
    "require": {
        "bt51/ntp": "dev-master"
    }
}

Read more on composer here: http://getcomposer.org

Usage

Getting the current time from an ntp server is simple.

<?php

use Bt51\NTP\Socket;
use Bt51\NTP\Client;

$socket = new Socket('0.pool.ntp.org', 123); 
$ntp = new Client($socket);
$time = $ntp->getTime();
var_dump($time);

The current time returned from the ntp server will be converted to a DateTime object. The timezone will always be UTC.

License

MIT

统计信息

  • 总下载量: 57.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 13
  • 点击次数: 1
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 12
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-03-09