TimeSync.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 [email protected] 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: TimeSync.php 24593 2012-01-05 20:35:02Z matthew $
\Zend_TimeSync
- Implements
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties

array $_allowedSchemes = array('Ntp', 'Sntp')Allowed timeserver schemes
array('Ntp', 'Sntp')Details- Type
- array

object $_current = Holds a reference to the timeserver that is currently being used
- Type
- object

array $_timeservers = array()Contains array of timeserver objects
array()Details- Type
- array
Methods

__construct(string | array $target = null, string $alias = null) : objectZend_TimeSync constructor
| Name | Type | Description |
|---|---|---|
| $target | string | array |
|
| $alias | string |
|
| Type | Description |
|---|---|
| object |

_addServer(string | array $target, string $alias) : voidAdds a timeserver object to the timeserver list
| Name | Type | Description |
|---|---|---|
| $target | string | array |
|
| $alias | string |
|

addServer(string | array $target, string $alias = null) : voidAdd a timeserver or multiple timeservers
Server should be a single string representation of a timeserver, or a structured array listing multiple timeservers.
If you provide an array of timeservers in the $target variable, $alias will be ignored. you can enter these as the array key in the provided array, which should be structured as follows:
$example = array(
'server_a' => 'ntp://127.0.0.1',
'server_b' => 'ntp://127.0.0.1:123',
'server_c' => 'ntp://[2000:364:234::2.5]',
'server_d' => 'ntp://[2000:364:234::2.5]:123'
);
If no port number has been suplied, the default matching port number will be used.
Supported protocols are: - ntp - sntp
| Name | Type | Description |
|---|---|---|
| $target | string | array |
|
| $alias | string |
|
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception |

getDate(\Zend_Locale $locale = null) : objectQuery the timeserver list using the fallback mechanism
If there are multiple servers listed, this method will act as a facade and will try to return the date from the first server that returns a valid result.
| Name | Type | Description |
|---|---|---|
| $locale | \Zend_Locale |
|
| Type | Description |
|---|---|
| object |
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception |

getInfo() : arrayReturns information sent/returned from the current timeserver
| Type | Description |
|---|---|
| array |

getIterator() : \ArrayObjectgetIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
| Type | Description |
|---|---|
| \ArrayObject |

getOptions(string $key = null) : mixedReturns the value to the option
| Name | Type | Description |
|---|---|---|
| $key | string |
|
| Type | Description |
|---|---|
| mixed |
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception |

getServer(string | integer $alias = null) : objectReturn a specified timeserver by alias If no alias is given it will return the current timeserver
| Name | Type | Description |
|---|---|---|
| $alias | string | integer |
|
| Type | Description |
|---|---|
| object |
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception |

setOptions(array $options) : voidSets the value for the given options
This will replace any currently defined options.
| Name | Type | Description |
|---|---|---|
| $options | array |
|

setServer(string | integer $alias) : voidMarks a nameserver as current
| Name | Type | Description |
|---|---|---|
| $alias | string | integer |
|
| Exception | Description |
|---|---|
| \Zend_TimeSync_Exception |