TimeSync/Ntp.php
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-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_TimeSync
- Version
- $Id: Ntp.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_TimeSync_Ntp
- Parent(s)
- \Zend_TimeSync_Protocol
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

array $_info = array()array()Details- Type
- array
- Inherited_from
- \Zend_TimeSync_Protocol::$$_info

integer $_port = 123123Details- Type
- integer
Methods

__construct(string $timeserver, integer $port = 123) : voidNTP class constructor, sets the timeserver and port number
| Name | Type | Description |
|---|---|---|
| $timeserver | string | Adress of the timeserver to connect to |
| $port | integer | (Optional) Port for this timeserver |

_disconnect() : voidDisconnects from the peer, closes the socket.
Inherited from: \Zend_TimeSync_Protocol::_disconnect()
_extract(string | array $binary) : integerExtracts the binary data returned from the timeserver
| Name | Type | Description |
|---|---|---|
| $binary | string | array | Data returned from the timeserver |
| Type | Description |
|---|---|
| integer | Difference in seconds |

_getFloat(string $input) : floatCalculates a 32bit signed fixed point number
| Name | Type | Description |
|---|---|---|
| $input | string |
| Type | Description |
|---|---|
| float |

_getInteger(string $input) : integerCalculates a 32bit integer
| Name | Type | Description |
|---|---|---|
| $input | string |
| Type | Description |
|---|---|
| integer |

_getTimestamp(string $input) : floatCalculates a 64bit timestamp
| Name | Type | Description |
|---|---|---|
| $input | string |
| Type | Description |
|---|---|
| float |

_prepare() : stringPrepare 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
| Type | Description |
|---|---|
| string |

_read() : arrayReads the data returned from the timeserver
This will return an array with binary data listing:
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception | When timeserver can not be connected |

_write(string $data) : voidSends the NTP packet to the server
| Name | Type | Description |
|---|---|---|
| $data | string | Data to send to the timeserver |

getDate(string | \Zend_Locale $locale = null) : \Zend_DateQuery this timeserver without using the fallback mechanism
Inherited from: \Zend_TimeSync_Protocol::getDate()| Name | Type | Description |
|---|---|---|
| $locale | string | \Zend_Locale | (Optional) Locale |
| Type | Description |
|---|---|
| \Zend_Date |

getInfo() : arrayReturn information sent/returned from the timeserver
Inherited from: \Zend_TimeSync_Protocol::getInfo()| Type | Description |
|---|---|
| array |