API Documentation

TimeSync/Ntp.php

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-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_TimeSync  
version
$Id: Ntp.php 23775 2011-03-01 17:25:24Z ralph $  

\Zend_TimeSync_Ntp

NTP Protocol handling class

Extends from
\Zend_TimeSync_Protocol
category
Zend  
copyright
Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)  
license
New BSD License  
package
Zend_TimeSync  

Properties

Propertyprotectedinteger  $_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
Name Type Description
$timeserver string Adress of the timeserver to connect to
$port integer

(Optional) Port for this timeserver

methodprotected_connect( ) : void

Connect to the specified timeserver.

Inherited from: \Zend_TimeSync_Protocol::_connect()
Throws
Exception Description
\Zend_TimeSync_Exception When the connection failed
methodprotected_disconnect( ) : void

Disconnects from the peer, closes the socket.

Inherited from: \Zend_TimeSync_Protocol::_disconnect()
methodprotected_extract( string|array $binary ) : integer

Extracts the binary data returned from the timeserver

Parameters
Name Type Description
$binary string|array Data returned from the timeserver
Returns
Type Description
integer Difference in seconds
methodprotected_getFloat( string $input ) : float

Calculates a 32bit signed fixed point number

Parameters
Name Type Description
$input string
Returns
Type Description
float
methodprotected_getInteger( string $input ) : integer

Calculates a 32bit integer

Parameters
Name Type Description
$input string
Returns
Type Description
integer
methodprotected_getTimestamp( string $input ) : float

Calculates a 64bit timestamp

Parameters
Name Type Description
$input string
Returns
Type Description
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
Type Description
string
methodprotected_read( ) : array

Reads the data returned from the timeserver

This will return an array with binary data listing:

Returns
Type Description
array
Throws
Exception Description
\Zend_TimeSync_Exception When timeserver can not be connected
methodprotected_write( string $data ) : void

Sends the NTP packet to the server

Parameters
Name Type Description
$data string Data to send to the timeserver
methodpublicgetDate( string|\Zend_Locale $locale = null ) : \Zend_Date

Query this timeserver without using the fallback mechanism

Inherited from: \Zend_TimeSync_Protocol::getDate()
Parameters
Name Type Description
$locale string|\Zend_Locale

(Optional) Locale

Returns
Type Description
\Zend_Date
methodpublicgetInfo( ) : array

Return information sent/returned from the timeserver

Inherited from: \Zend_TimeSync_Protocol::getInfo()
Returns
Type Description
array
Documentation was generated by DocBlox 0.13.3.