[LinuxPPS] offset issues: solution?

Udo van den Heuvel udovdh at xs4all.nl
Sun Oct 8 10:42:10 CEST 2006


Rodolfo Giometti wrote:
>> So why did ntpd work although the link was not good?
>> I would expect it to fail with an error and quit.
>>
>> Can we fix this? (since it gives bad clock if the link is not OK)
> 
> Are you sure that in your refclock you return an error code in this
> situation? Notice that the warning message cames from the refclock
> itself «ntpd[11616]: refclock:...».

See the code snippet below. It is the reflock_nmea with the latest nmea
patch:

#ifdef PPS_HAVE_FINDPATH
        /* Get the PPS source's real name */
        time_pps_readlink(link, LENPPS, path, LENPPS);

        /* Try to find the source */
        fd = time_pps_findpath(path, LENPPS, id, LENPPS);
        if (fd < 0) {
                msyslog(LOG_ERR, "refclock: cannot find PPS path \"%s\"
in the system", path);
                return 1;
        }
        msyslog(LOG_INFO, "refclock: found PPS source \"%s\" at id #%d
on \"%s\"", path, fd, id);
#endif  /* PPS_HAVE_FINDPATH */

As you see we return 1 if there is no path found.

> So you should check that, in this situation, your refclock returns an
> error code.

ntpd shows the message so fd <0 is true. This means that 1 is returned.
Should we return something else?

BTW: What is the difference between return 1 and return (1)?

Udo



More information about the LinuxPPS mailing list