Definition at line 34 of file TimeSync.php.
 
◆ __construct()
      
        
          | __construct | ( |  | $target = null, | 
        
          |  |  |  | $alias = null | 
        
          |  | ) |  |  | 
      
 
Zend_TimeSync constructor
- Parameters
- 
  
    | string | array | $target | - OPTIONAL single timeserver, or an array of timeservers. |  | string | $alias | - OPTIONAL an alias for this timeserver |  
 
- Returns
- object 
Definition at line 83 of file TimeSync.php.
addServer($target, $alias=null)
 
 
 
◆ _addServer()
  
  | 
        
          | _addServer | ( |  | $target, |  
          |  |  |  | $alias |  
          |  | ) |  |  |  | protected | 
 
Adds a timeserver object to the timeserver list
- Parameters
- 
  
    | string | array | $target | - Single timeserver, or an array of timeservers. |  | string | $alias | - An alias for this timeserver |  
 
Definition at line 264 of file TimeSync.php.
  274         if (
$pos = strrpos($adress, 
':')) {
   275             $posbr = strpos($adress, 
']');
   276             if ($posbr and (
$pos > $posbr)) {
   277                 $port = substr($adress, 
$pos + 1);
   278                 $adress = substr($adress, 0, 
$pos);
   279             } 
else if (!$posbr and 
$pos) {
   280                 $port = substr($adress, 
$pos + 1);
   281                 $adress = substr($adress, 0, 
$pos);
   289         $protocol = ucfirst(strtolower($protocol));
   290         if (!in_array($protocol, $this->_allowedSchemes)) {
   291             #require_once 'Zend/TimeSync/Exception.php';   297             #require_once 'Zend/Loader.php';   300         $timeServerObj = 
new $className($adress, $port);
   302         $this->_timeservers[
$alias] = $timeServerObj;
 
static loadClass($class, $dirs=null)
 
 
◆ addServer()
      
        
          | addServer | ( |  | $target, | 
        
          |  |  |  | $alias = null | 
        
          |  | ) |  |  | 
      
 
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:
 $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:
- Parameters
- 
  
    | string | array | $target | - Single timeserver, or an array of timeservers. |  | string | $alias | - OPTIONAL an alias for this timeserver |  
 
- Exceptions
- 
  
  
Definition at line 131 of file TimeSync.php.
  134             foreach (
$target as $key => $server) {
 
_addServer($target, $alias)
 
 
◆ getDate()
      
        
          | getDate | ( |  | $locale = null | ) |  | 
      
 
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.
- Parameters
- 
  
  
- Returns
- object 
- Exceptions
- 
  
  
Definition at line 240 of file TimeSync.php.
  242         #require_once 'Zend/TimeSync/Exception.php';   243         foreach ($this->_timeservers as 
$alias => $server) {
   244             $this->_current = $server;
   246                 return $server->getDate($locale);
   248                 if (!isset($masterException)) {
   251                 $masterException->addException($e);
   255         throw $masterException;
 
 
 
◆ getInfo()
Returns information sent/returned from the current timeserver
- Returns
- array 
Definition at line 224 of file TimeSync.php.
 
 
◆ getIterator()
getIterator() - return an iteratable object for use in foreach and the like, this completes the IteratorAggregate interface
- Returns
- ArrayObject 
Definition at line 96 of file TimeSync.php.
   98         return new ArrayObject($this->_timeservers);
  
 
◆ getOptions()
  
  | 
        
          | static getOptions | ( |  | $key = null | ) |  |  | static | 
 
Returns the value to the option
- Parameters
- 
  
    | string | $key | - The option's identifier |  
 
- Returns
- mixed 
- Exceptions
- 
  
  
Definition at line 179 of file TimeSync.php.
  188             #require_once 'Zend/TimeSync/Exception.php'; 
 
 
◆ getServer()
      
        
          | getServer | ( |  | $alias = null | ) |  | 
      
 
Return a specified timeserver by alias If no alias is given it will return the current timeserver
- Parameters
- 
  
    | string | integer | $alias | - The alias from the timeserver to return |  
 
- Returns
- object 
- Exceptions
- 
  
  
Definition at line 201 of file TimeSync.php.
  204             if (isset($this->_current) && $this->_current !== 
false) {
   207                 #require_once 'Zend/TimeSync/Exception.php';   211         if (isset($this->_timeservers[
$alias]) === 
true) {
   212             return $this->_timeservers[
$alias];
   214             #require_once 'Zend/TimeSync/Exception.php'; 
 
 
◆ setOptions()
  
  | 
        
          | static setOptions | ( | array | $options | ) |  |  | static | 
 
Sets the value for the given options
This will replace any currently defined options.
- Parameters
- 
  
    | array | $options | - An array of options to be set |  
 
Definition at line 149 of file TimeSync.php.
 
 
◆ setServer()
Marks a nameserver as current
- Parameters
- 
  
    | string | integer | $alias | - The alias from the timeserver to set as current |  
 
- Exceptions
- 
  
  
Definition at line 162 of file TimeSync.php.
  164         if (isset($this->_timeservers[
$alias]) === 
true) {
   165             $this->_current = $this->_timeservers[
$alias];
   167             #require_once 'Zend/TimeSync/Exception.php'; 
 
 
◆ $_allowedSchemes
◆ $_current
◆ $_timeservers
◆ $options
Initial value:= array(
        'timeout' => 1
    )
Definition at line 72 of file TimeSync.php.
 
 
◆ DEFAULT_PROTOCOL
      
        
          | const DEFAULT_PROTOCOL = 'Ntp' | 
      
 
Set the default timeserver protocol to "Ntp". This will be called when no protocol is specified 
Definition at line 40 of file TimeSync.php.
 
 
The documentation for this class was generated from the following file: