Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Time Servers Options

There is only one option within Zend_TimeSync which will be used internally: timeout. You can set any self-defined option you are in need of and request it, however.

The option timeout defines the number of seconds after which a connection is detected as broken when there was no response. The default value is 1, which means that Zend_TimeSync will fallback to the next time server if the requested time server does not respond in one second.

With the setOptions() method, you can set any option. This function accepts an array where the key is the option to set and the value is the value of that option. Any previously set option will be overwritten by the new value. If you want to know which options are set, use the getOptions() method. It accepts either a key which returns the given option if specified, or, if no key is set, it will return all set options.

::setOptions(array('timeout' => 3'myoption' => 'timesync'));
$server = new Zend_TimeSync(array('generic'  => 'ntp:\\',
'fallback' => 'ntp:\\'));

"Timeout = " Zend_TimeSync::getOptions('timeout');

As you can see, the options for Zend_TimeSync are static. Each instance of Zend_TimeSync will use the same options.

Zend Framework