[ntp:questions] NTP on embedded Linux with GPRS connection

David Lord snews at lordynet.org
Wed Nov 23 19:59:29 UTC 2011


mass85 at tlen.pl wrote:
> I have Linux running on ARM. System has GPRS connection to internet,
> which is slow and unreliable (sometimes it is very hard to establish
> it, that's probably GSM operator's fault).
> 
> What I want to achieve is:
> 1. set time as precisely as possible at Linux startup, before my
> applications are started (note that system could have been down for a
> few days)
> 2. maintain small offset in a long term even if I establish connection
> with Internet only twice a day for not very long period of time (let's
> say 30minutes, but can be longer if necessary)
> 3. never step clock when my applications are running, only slew it
> 
> The first goal I can achieve in two ways I can think of:
> - connect to Internet before applications are started, run "ntpdate -
> b"
> - use hwclock --adjust. So after ntpd synchronises the time, I would
> have to issue "hwclock -w -u" and repeat it after at least 24h, so
> hwclock can estimate the drift. Then repeat this process.
> There is a big drawback of the former solution: connection setup can
> last long and we don't have any guarantee that we will finally
> connect. The latter solution is probably not very accurate and I
> wonder if ntpd could not issue hwclock command in the right moment?
> Is ntpd able to apply proper clock adjustment at Linux startup without
> connecting to Internet based on the results of synchronisation before
> system reboot?
> 
> Are all three goals achievable together?

I've used gprs with usb dongle and on either Ubuntu or NetBSD.
The main problem was the gprs being very slow to respond until
it had adjusted to any significant level of traffic. I'm not
sure if Ubuntu uses ntpdate at startup or if it's redundant
with NetBSD but either way it wasn't possible to get a reliable
timesetting at startup until I used 'burst'. It might be that
iburst would have been sufficient by then but I had setup a pool
server so using that option was ok for me and I had also set a
long default poll interval. At startup rtt was sometimes around
10 seconds and when connection was fully established the lowest
rtt was above 150ms. I would not rely on any timings being
useful for adjustment of hwclock.


David

> Regards
> Marcin Adamski



More information about the questions mailing list