Example #1
0
 /**
  * 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.
  *
  * @param   $locale - OPTIONAL locale
  * @return  object
  * @throws  \Zend\TimeSync\Exception
  */
 public function getDate($locale = null)
 {
     foreach ($this->_timeservers as $alias => $server) {
         $this->_current = $server;
         try {
             return $server->getDate($locale);
         } catch (Exception $e) {
             if (!isset($masterException)) {
                 $masterException = new Exception('all timeservers are bogus');
             }
             $masterException->addException($e);
         }
     }
     throw $masterException;
 }