[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Ntpd: bug and patch: not reporting lost sync
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2013-05-22 16:19:29
Message-ID: CAK1hOcMah0mUeg8vXR4P69gsx6a3ag3DZuW4zeSp+=xYXuMoMw () mail ! gmail ! com
[Download RAW message or body]

On Fri, May 3, 2013 at 3:47 PM, Andreas Helmcke <ahe@helmcke.name> wrote:
> Hello,
> 
> I am trying to find a way to keep hwclock in sync with the ntp-synced system time \
> using busysbox ntpd. Ntpd is able to start a script after each change and every 11 \
> minutes (parameter -S) but there seems to be no way to find out if the time is \
> still synchronized i.e. there is at least one valid ntp server. The attached patch \
> exports one more value to the script (last_update_recv_time) so that the script can \
> at least check if the last update is within some limit.
> I consider this a workaround rather than a real solution because I would expect
> ntpd to set stratum to 16 when loosing contact to the upstream ntp servers but I \
> could not find a proper way to handle this. Anyone any suggestions?

I will add something like this in main loop:


                if (G.ntp_peers && G.stratum != MAXSTRAT) {
                        for (item = G.ntp_peers; item != NULL; item =
item->link) {
                                peer_t *p = (peer_t *) item->data;
                                if (p->p->reachable_bits)
                                        goto have_reachable_peer;
                        }
                        /* No peer responded for last 8 packets, panic */
                        G.polladj_count = 0;
                        G.poll_exp = MINPOLL;
                        G.stratum = MAXSTRAT;
                        run_script("unsync", G.last_update_offset);
 have_reachable_peer: ;
                }
        } /* while (!bb_got_signal) */

and the script can look for unsync event.
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic