PhpRiot
Follow phpriot on Twitter
Sponsored Link
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
Free iPad/iPhone App
Available on the App Store

  • PHP manual
  • Zend Framework manual
  • Smarty manual
  • PHP articles
  • PHP training

Protocols of Time Servers

There are different types of time servers. Most public time servers use the NTP protocol. But there are other time synchronization protocols available.

You set the proper protocol in the address of the time server. There are two protocols which are supported by Zend_TimeSync: NTP and SNTP. The default protocol is NTP. If you are using NTP, you can omit the protocol in the address as demonstrated in the previous examples.

<?php
$server 
= new Zend_TimeSync(array('generic'  => 'ntp:\\0.pool.ntp.org',
                                  
'fallback' => 'ntp:\\1.pool.ntp.org',
                                  
'reserve'  => 'ntp:\\2.pool.ntp.org'));
$server->addServer('sntp:\\internal.myserver.com''additional');

print 
$server->getDate()->getIso();

Zend_TimeSync can handle mixed time servers. So you are not restricted to only one protocol; you can add any server independently from its protocol.

Zend Framework