diff -r 000000000000 -r 4eba9c11703f web/Zend/TimeSync/Protocol.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/Zend/TimeSync/Protocol.php Mon Dec 13 18:29:26 2010 +0100 @@ -0,0 +1,148 @@ +_timeserver, $this->_port, $errno, $errstr, + Zend_TimeSync::$options['timeout']); + if ($socket === false) { + throw new Zend_TimeSync_Exception('could not connect to ' . + "'$this->_timeserver' on port '$this->_port', reason: '$errstr'"); + } + + $this->_socket = $socket; + } + + /** + * Disconnects from the peer, closes the socket. + * + * @return void + */ + protected function _disconnect() + { + @fclose($this->_socket); + $this->_socket = null; + } + + /** + * Return information sent/returned from the timeserver + * + * @return array + */ + public function getInfo() + { + if (empty($this->_info) === true) { + $this->_write($this->_prepare()); + $timestamp = $this->_extract($this->_read()); + } + + return $this->_info; + } + + /** + * Query this timeserver without using the fallback mechanism + * + * @param string|Zend_Locale $locale (Optional) Locale + * @return Zend_Date + */ + public function getDate($locale = null) + { + $this->_write($this->_prepare()); + $timestamp = $this->_extract($this->_read()); + + $date = new Zend_Date($this, null, $locale); + return $date; + } +}