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

 Methods

Zend_TimeSync constructor

__construct(string|array $target = null, string $alias = null) : object

Parameters

$target

stringarray
  • OPTIONAL single timeserver, or an array of timeservers.

$alias

string
  • OPTIONAL an alias for this timeserver

Returns

object

Add a timeserver or multiple timeservers

addServer(string|array $target, string $alias = null

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

Parameters

$target

stringarray
  • Single timeserver, or an array of timeservers.

$alias

string
  • OPTIONAL an alias for this timeserver

Exceptions

\Zend_TimeSync_Exception

Query the timeserver list using the fallback mechanism

getDate(\Zend_Locale $locale = null) : object

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.

Parameters

$locale

\Zend_Locale
  • OPTIONAL locale

Exceptions

\Zend_TimeSync_Exception

Returns

object

Returns information sent/returned from the current timeserver

getInfo() : array

Returns

array

getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface

getIterator() : \ArrayObject

Returns

\ArrayObject

Returns the value to the option

getOptions(string $key = null) : mixed
Static

Parameters

$key

string
  • The option's identifier

Exceptions

\Zend_TimeSync_Exception

Returns

mixed

Return a specified timeserver by alias If no alias is given it will return the current timeserver

getServer(string|integer $alias = null) : object

Parameters

$alias

stringinteger
  • The alias from the timeserver to return

Exceptions

\Zend_TimeSync_Exception

Returns

object

Sets the value for the given options

setOptions(array $options) 
Static

This will replace any currently defined options.

Parameters

$options

array
  • An array of options to be set

Marks a nameserver as current

setServer(string|integer $alias) 

Parameters

$alias

stringinteger
  • The alias from the timeserver to set as current

Exceptions

\Zend_TimeSync_Exception

Adds a timeserver object to the timeserver list

_addServer(string|array $target, string $alias) 

Parameters

$target

stringarray
  • Single timeserver, or an array of timeservers.

$alias

string
  • An alias for this timeserver

 Properties

 

Configuration array, set using the constructor or using ::setOptions() or ::setOption()

$options : array

Default

array('timeout' => 1)
Static
 

Allowed timeserver schemes

$_allowedSchemes : array

Default

array('Ntp', 'Sntp')
 

Holds a reference to the timeserver that is currently being used

$_current : object

Default

 

Contains array of timeserver objects

$_timeservers : array

Default

array()

 Constants

 

Set the default timeserver protocol to "Ntp". This will be called when no protocol is specified

DEFAULT_PROTOCOL = 'Ntp'