Zend Framework  1.12
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Zend_TimeSync_Ntp Class Reference

Public Member Functions

 __construct ($timeserver, $port=123)
 NTP class constructor, sets the timeserver and port number.
 
- Public Member Functions inherited from Zend_TimeSync_Protocol
 getInfo ()
 Return information sent/returned from the timeserver.
 
 getDate ($locale=null)
 Query this timeserver without using the fallback mechanism.
 

Protected Member Functions

 _prepare ()
 Prepare local timestamp for transmission in our request packet.
 
 _getInteger ($input)
 Calculates a 32bit integer.
 
 _getFloat ($input)
 Calculates a 32bit signed fixed point number.
 
 _getTimestamp ($input)
 Calculates a 64bit timestamp.
 
 _read ()
 Reads the data returned from the timeserver.
 
 _write ($data)
 Sends the NTP packet to the server.
 
 _extract ($binary)
 Extracts the binary data returned from the timeserver.
 
- Protected Member Functions inherited from Zend_TimeSync_Protocol
 _prepare ()
 Abstract method that prepares the data to send to the timeserver.
 
 _read ()
 Abstract method that reads the data returned from the timeserver.
 
 _write ($data)
 Abstract method that writes data to to the timeserver.
 
 _extract ($data)
 Abstract method that extracts the binary data returned from the timeserver.
 
 _connect ()
 Connect to the specified timeserver.
 
 _disconnect ()
 Disconnects from the peer, closes the socket.
 

Protected Attributes

 $_port = 123
 
- Protected Attributes inherited from Zend_TimeSync_Protocol
 $_socket
 
 $_exceptions
 
 $_timeserver
 
 $_info = array()
 

Constructor & Destructor Documentation

__construct (   $timeserver,
  $port = 123 
)

NTP class constructor, sets the timeserver and port number.

Parameters
string$timeserverAdress of the timeserver to connect to
integer$port(Optional) Port for this timeserver

Member Function Documentation

_extract (   $binary)
protected

Extracts the binary data returned from the timeserver.

Parameters
string | array$binaryData returned from the timeserver
Returns
integer Difference in seconds
_getFloat (   $input)
protected

Calculates a 32bit signed fixed point number.

Parameters
string$input
Returns
float
_getInteger (   $input)
protected

Calculates a 32bit integer.

Parameters
string$input
Returns
integer
_getTimestamp (   $input)
protected

Calculates a 64bit timestamp.

Parameters
string$input
Returns
float
_prepare ( )
protected

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
string
_read ( )
protected

Reads the data returned from the timeserver.

This will return an array with binary data listing:

Returns
array
Exceptions
Zend_TimeSync_ExceptionWhen timeserver can not be connected
_write (   $data)
protected

Sends the NTP packet to the server.

Parameters
string$dataData to send to the timeserver
Returns
void

Member Data Documentation

$_port = 123
protected