Help Contents


Home   Chronometer
Where to Buy


Emerald Chronometer Time Synchronization

Emerald Chronometer uses a simplified version of Network Time Protocol (NTP) to synchronize its time displays with time servers on the Internet. That's the short and simple version. The longer, more technical, version follows:

Every time Emerald Chronometer starts up and the "Use NTP" option is ON or whenever that option is changed to ON, the app goes out to NTP servers on the Internet and asks for the current time. It chooses a pool of servers based on the user's country setting: first from the local country's pool, then the continent pool for that country, then the global pool, and finally time.apple.com. This progression happens each time we get a new synchronization; there are four sets of servers in each pool. Emerald Chronometer compares the time thus obtained with the time supplied by the iPhone, and stores the difference as a "skew" value. This skew is applied globally throughout the application to every watch display, with a couple of exceptions described further on. display.

The size of this skew is completely dependent on how accurate the time supplied by the telephone carrier's signal is. In the SF Bay Area where the authors live, it typically varies by up to a few seconds in either direction. In other areas it is reportedly larger. The iPod touch uses a different synchronization mechanism, synchronizing with your desktop computer, so there it will depend on the accuracy of your desktop computer. (You can see the current skew value here.)

When you shut down and restart Emerald Chronometer, it will start with the same skew value as it determined during the previous session, but it will also go get a new skew value in case it has changed since the last time the application was run. If the skew has changed (or if this is the first time the application has ever been run), then the hands showing the time will jump to the new correct value.

When the iPhone gets a new cell-phone time (for example, when it switches to a different tower), the iPhone OS changes its internal time base used by all applications, and sends a notification to running applications that the time has changed. When Emerald Chronometer gets this notification, it immediately changes the skew value by the amount that the internal time base has apparently shifted; it makes an educated guess at this shift by noting how much the iPhone time has changed on each internal heartbeat (see below). Then it again goes out to the NTP servers to get the actual skew, which is typically quite close to the "educated guess". Occasionally, especially in fringe-reception areas, you will see the time indicator blink for a few seconds while it does this.

The internal heartbeat code used for the "educated guess" is a separate thread with a timer that goes off periodically. Each time the timer goes off, the iPhone's internal time is noted; if the time base has not changed, the measured interval should be very close to the interval requested by the timer. If the time base did change, though, one of the intervals will have a value larger or smaller than that requested (it can even go negative), and the difference between the expected interval and the actual interval is the "educated guess" about the internal time-base shift.

There is special code to handle the interval timing that is done in Thebes, the countdown-timer watch, and Olympia, the stopwatch. In those two cases, if the timer is started while the watch is still unsynchronized, then the interval start may not be precisely determined. But when the first synchronization does come in, the internal heartbeat code mentioned above is again used, to back-calculate where the interval actually started, and the recorded timer start is adjusted appropriately. This is a bit complex, but the end result is that hands which display interval timing will move smoothly through cell-tower time changes before and including the first synchronization, unlike other time hands. After synchronization, all hands will continue to move smoothly.

When waking up after the screen has been locked, Emerald Chronometer will often need to resynchronize with NTP, because to save power the iPhone's internal clocks are allowed to shut down while the screen is locked. To maintain full NTP synchronization while the screen is locked and avoid the need to resynchronize when unlocking, you can set an alarm on Istanbul or Thebes; if an alarm has been set, Emerald Chronometer keeps the internal clocks going so that the alarm can be sounded at the correct time. The battery will drain about 50% faster if an alarm has been set.




The Watches

                    
Copyright © 2009, Emerald Sequoia LLC; last updated: 2009 November 25

Help Contents

Copyright Information