API Documentation

TimeSync/Ntp.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_TimeSync
version
$Id: Ntp.php 21481 2010-03-13 22:09:50Z thomas $
Classes
Zend_TimeSync_Ntp

Description

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.

Zend_TimeSync_Ntp

Extends from
Zend_TimeSync_Protocol
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_TimeSync
Properties
$_port
Methods
__construct
_prepare
_getInteger
_getFloat
_getTimestamp
_read
_write
_extract

Description

NTP Protocol handling class

Properties

$_port

integer $_port = '123'

NTP port number (123) assigned by the Internet Assigned Numbers Authority

Details

$_port
integer
visibility
protected
default
123
final
false
static
false

Methods

__construct

__construct( string $timeserver, integer $port = 123 ) :

NTP class constructor, sets the timeserver and port number

Arguments
$timeserver
string
Adress of the timeserver to connect to
$port
integer
(Optional) Port for this timeserver
Details
visibility
public
final
false
static
false

_extract

_extract( string|array $binary ) : integer

Extracts the binary data returned from the timeserver

Arguments
$binary
stringarray
Data returned from the timeserver
Output
integer
Difference in seconds
Details
visibility
protected
final
false
static
false

_getFloat

_getFloat( string $input ) : float

Calculates a 32bit signed fixed point number

Arguments
$input
string
Output
float
Details
visibility
protected
final
false
static
false

_getInteger

_getInteger( string $input ) : integer

Calculates a 32bit integer

Arguments
$input
string
Output
integer
Details
visibility
protected
final
false
static
false

_getTimestamp

_getTimestamp( string $input ) : float

Calculates a 64bit timestamp

Arguments
$input
string
Output
float
Details
visibility
protected
final
false
static
false

_prepare

_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

Output
string
Details
visibility
protected
final
false
static
false

_read

_read( ) : array

Reads the data returned from the timeserver

This will return an array with binary data listing:

Output
array
Details
visibility
protected
final
false
static
false
throws
When timeserver can not be connected

_write

_write( string $data ) : void

Sends the NTP packet to the server

Arguments
$data
string
Data to send to the timeserver
Details
visibility
protected
final
false
static
false
Documentation was generated by DocBlox.