TimeSync/Ntp.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_TimeSync  
Version
$Id$  

\Zend_TimeSync_Ntp

Package: Zend_TimeSync
NTP Protocol handling class
Parent(s)
\Zend_TimeSync_Protocol
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotectedinteger $_port = 123
NTP port number (123) assigned by the Internet Assigned Numbers Authority
Default value123Details
Type
integer

Methods

methodpublic__construct(string $timeserver, integer $port = 123) : void

NTP class constructor, sets the timeserver and port number

Parameters
NameTypeDescription
$timeserverstring

Adress of the timeserver to connect to

$portinteger

(Optional) Port for this timeserver

methodprotected_extract(string | array $binary) : integer

Extracts the binary data returned from the timeserver

Parameters
NameTypeDescription
$binarystring | array

Data returned from the timeserver

Returns
TypeDescription
integerDifference in seconds
methodprotected_getFloat(string $input) : float

Calculates a 32bit signed fixed point number

Parameters
NameTypeDescription
$inputstring
Returns
TypeDescription
float
methodprotected_getInteger(string $input) : integer

Calculates a 32bit integer

Parameters
NameTypeDescription
$inputstring
Returns
TypeDescription
integer
methodprotected_getTimestamp(string $input) : float

Calculates a 64bit timestamp

Parameters
NameTypeDescription
$inputstring
Returns
TypeDescription
float
methodprotected_prepare() : string

Prepare local timestamp for transmission in our request packet

NTP timestamps are represented as a 64-bit fixed-point number, in seconds relative to 0000 UT on 1 January 1900. The integer part is in the first 32 bits and the fraction part in the last 32 bits
Returns
TypeDescription
string
methodprotected_read() : array

Reads the data returned from the timeserver

This will return an array with binary data listing:
Returns
TypeDescription
array
Throws
ExceptionDescription
\Zend_TimeSync_ExceptionWhen timeserver can not be connected
methodprotected_write(string $data) : void

Sends the NTP packet to the server

Parameters
NameTypeDescription
$datastring

Data to send to the timeserver

Documentation was generated by phpDocumentor 2.2.0 .