Time synchronization for Android via TimeServer
Knowing the precise time is very important in the modern world, where everything can change literally in a matter of minutes. Sometimes just a few seconds can be granted in order to solve the problem. Fortunately, the capability to know the precise time anywhere in the world is not a difficult task. It is enough to have at hand any device with the access to the Internet. Let’s consider how to determine the precise time on smartphones and tablets operating under Android.
About time synchronization
There are various ways to determine the precise time. For ordinary people, the most convenient and easy way is to use time synchronization servers (NTP server). Most operating systems installed on computers and mobile devices have a built-in feature for working with such NTP-servers. The algorithm for synchronizing the device's internal time with time on a remote server is quite simple:
- The user device sends off a request to the synchronization server using a special network protocol — NTP (Network Time Protocol).
- In response to the request, the server generates an NTP packet with the required data and sends it back to the user device.
- The built-in synchronization feature processes the packet and adjusts the internal time of the device using the data from the NTP packet.
- High synchronization precision (up to one hundredth of a second, i.e. 10 milliseconds) is achieved due to the fact that the time setting function takes into account the delay between sending off the request and receiving the NTP-packet from server.
The NTP server itself determines the precise time according to a really (physically) existing time standard. This is a whole complex of equipment which task is to count time. There are several time standards in the world located in technologically advanced countries, including Russia. The atomic clock is available at the All-Russian Scientific Research Institute of Physicotechnical and Radiotechnical Measurements (VNIIFTRI).
Time synchronization with TimeServer on Android
Android operating systems also have a built-in feature of time synchronization via the net. However, users can not configure it. The system checks the time with the NTP server, which, in fact, is unknown to the owner of the Android device. It also remains a secret how exactly the basic time synchronization feature works under Android.
For the time synchronization on smartphones and tablets running under Android there is only one way — the use of special applications. However, here there are some nuances. Android OS prohibits third-party applications to change the date and time settings, which is done for security reasons. In order to let the time synchronization applications work on a full scale, the user needs root-rights. Without the root-rights such programs can not change the system settings in automatic mode; however they can still determine the precise time. In this case, the user will occasionally have to manually set the time on his Android device.
Let's learn how it is done using an example of time synchronization application ClockSync with NTP-server timeserver.ru.
ClockSync with root-rights
ClockSync without root-rights
Follow steps 1 to 6 according to the instructions above. After the server has been set, go to the main page of the application, open the settings menu and select "Synchronize" in it. The program will not be able to automatically change the system time, so the smartphone will open the time and date settings section, and a reverse timer will appear at the bottom of the screen.