IntroductionZend_TimeSync is able to receive internet or network time from a time server using the NTP or SNTP protocol. With Zend_TimeSync, Zend Framework is able to act independently from the time settings of the server where it is running. To be independent from the actual time of the server, Zend_TimeSync works with the difference of the real time which is sent through NTP or SNTP and the internal server's time.
Why Zend_TimeSync ?So why would someone use Zend_TimeSync ? Normally every server within a multi-server farm will have a service running which synchronizes its own time with a time server. So within a standard environment it should not be necessary to use Zend_TimeSync. But it can become handy if there is no service available and if you don't have the right to install such a service. Here are some example use cases, for which Zend_TimeSync is perfect suited:
Zend_TimeSync may provide a good solution in all of these cases and can be used if you are unable to run any services on your server. What is NTP ?The Network Time Protocol (NTP) is a protocol for synchronizing multiple systems' clocks over packet-switched, variable-latency data networks. NTP uses UDP port 123 as its transport layer. See the » wikipedia article for details about this protocol. What is SNTP?The Simple Network Time Protocol (SNTP) is a protocol synchronizing multiple systems' clocks over packet-switched, variable-latency data networks. SNTP uses UDP port 37 as its transport layer. It is closely related to the Network Time Protocol, but simpler. Problematic usageBe warned that when you are using Zend_TimeSync you will have to think about some details related to the structure of time sync and the internet itself. Correct usage and best practices will be described here. Read carefully before you begin using Zend_TimeSync. Decide which server to useYou should select the time server that you want to use very carefully according to the following criteria:
So where can you find a time server? Generally you can use any timeserver you can connect to. This can be a time server within your LAN or any public time server you have access to. If you decide to use a public time server, you should consider using a server pool. Server pools are public addresses from which you will get a random, pooled time server by requesting the time. This way you will not have to split your requests. There are public server pools available for many regions which you may use to avoid problems mentioned above. See » pool.ntp.org to find your nearest server pool. For example, if your server is located within Germany you can connect to 0.europe.pool.ntp.org.
|