## Zend_TimeSync

Description

Implements interfaces:

- IteratorAggregate (internal interface)

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

Located in /TimeSync.php (line 44)

Class Constant Summary
DEFAULT_PROTOCOL = 'Ntp'
Variable Summary
static array $options
array $_allowedSchemes
object $_current
array $_timeservers
Method Summary
object __construct ([string|array $target = null], [string $alias = null])
void addServer (string|array $target, [string $alias = null])
object get ([string|integer $alias = null])
object getCurrent ()
object getDate ([$locale $locale = false])
array getInfo ()
ArrayObject getIterator ()
mixed getOption (string $key)
void setCurrent ([string|integer $alias = null])
void setOption (integer|string $key, $value)
void setOptions ([array $options = array()])
void _addServer (string|array $target, string $alias)
Variables
static array $options = array(
'timeout' => 1
) (line 82)

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

- access: public

array $_allowedSchemes = array(
'Ntp',
'Sntp'
) (line 71)

Allowed timeserver schemes

- access: protected

object $_current (line 64)

Holds a reference to the timeserver that is currently being used

- access: protected

array $_timeservers = array() (line 57)

Contains array of timeserver objects

- access: protected

Methods
Constructor __construct (line 93)

Zend_TimeSync constructor

- access: public

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

- string|array $target: - OPTIONAL single timeserver, or an array of timeservers.
- string $alias:
  - OPTIONAL an alias for this timeserver

addServer (line 141)

Add 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:

1. $example = array(
2. 'server_a' => 'ntp://127.0.0.1',
3. 'server_b' => 'ntp://127.0.0.1:123',
4. 'server_c' => 'ntp://[2000:364:234::2.5]',
5. 'server_d' => 'ntp://[2000:364:234::2.5]:123'
6. );

If no port number has been suplied, the default matching port number will be used.

Supported protocols are:

- ntp
- sntp

- access: public
- throws: Zend_TimeSync_Exception

void addServer (string|array $target, [string $alias = null])

- string|array $target: - Single timeserver, or an array of timeservers.
- string $alias:
  - OPTIONAL an alias for this timeserver

get (line 227)

Return a specified timeserver by alias

- access: public
- throws: Zend_TimeSync_Exception

object get ([string|integer $alias = null])

- string|integer $alias: - The alias from the timeserver to return

getCurrent (line 242)

Returns the timeserver that is currently set

- access: public
- throws: Zend_TimeSync_Exception

object getCurrent ()
getDate (line 272)

Query 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.

- access: public
- throws: Zend_TimeSync_Exception

object getDate ([$locale $locale = false])

- $locale $locale: - OPTIONAL locale

getInfo (line 256)

Returns information sent/returned from the current timeserver

- access: public

array getInfo ()
getIterator (line 106)

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

- access: public

ArrayObject getIterator ()

Implementation of:

IteratorAggregate::getIterator

getOption (line 211)

Returns the value to the option

- access: public
- throws: Zend_TimeSync_Exception

mixed getOption (string $key)

- string $key: - The option's identifier

setCurrent (line 195)

Marks a nameserver as current

- access: public
- throws: Zend_TimeSync_Exception

void setCurrent ([string|integer $alias = null])

- string|integer $alias: - The alias from the timeserver to set as current

setOption (line 161)

Sets the value for a given option

This will replace any currently defined options.

- access: public
- throws: Zend_TimeSync_Exception

void setOption (integer|string $key, $value)

- integer|string $key: - The option's value
- $value

setOptions (line 178)

Sets the value for the given options

This will replace any currently defined options.

- access: public
- throws: Zend_TimeSync_Exception

void setOptions ([array $options = array()])

- array $options: - An array of options to be set

_addServer (line 295)

Adds a timeserver object to the timeserver list

- access: protected

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

- string|array $target:
  - Single timeserver, or an array of timeservers.
- string $alias:
  - An alias for this timeserver

Class Constants
DEFAULT_PROTOCOL = 'Ntp' (line 50)

Set the default timeserver protocol to "Ntp". This will be called

when no protocol is specified

Documentation generated on Wed, 21 Feb 2007 12:03:05 -0800 by phpDocumentor 1.3.1