diff options
author | Gary E. Miller <gem@rellim.com> | 2010-07-20 23:22:24 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2010-07-20 23:22:24 -0700 |
commit | a2d52ffe40b99002d70b68c2108d7c18f6464774 (patch) | |
tree | ee10bc433792d4eb72c0e541f1994a4e7b7adab7 /libgpsd_core.c | |
parent | 6cd7904db0904320182d8f510dd9451e970d7b1b (diff) | |
download | gpsd-a2d52ffe40b99002d70b68c2108d7c18f6464774.tar.gz |
Linux kernel PPS now drives ntpd.
Looks like this removes about 20uS of latency. Not pretty yet
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r-- | libgpsd_core.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c index 69ad7d65..d3c6636b 100644 --- a/libgpsd_core.c +++ b/libgpsd_core.c @@ -218,6 +218,8 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) (void)gettimeofday(&tv, NULL); #if defined(HAVE_TIMEPPS_H) if ( use_kernelpps ) { + /* on a quad core 2.4GHz Xeon this removes about 20uS of + * latency */ memset( (void *)&kernelpps_tv, 0, sizeof(kernelpps_tv)); if ( 0 > time_pps_fetch(kernelpps_handle, PPS_TSFMT_TSPEC , &pi, &kernelpps_tv)) { @@ -366,10 +368,16 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg) } /*@ -boolint @*/ if (NULL != log) { - gpsd_report(LOG_RAW, "%s\n", log); + gpsd_report(LOG_RAW, log); } if (0 != ok) { - (void)ntpshm_pps(session, &tv); + if ( use_kernelpps ) { + /* ntpshm_pps() expects usec, not nsec */ + pi.clear_timestamp.tv_nsec /= 1000; + (void)ntpshm_pps(session, &pi.clear_timestamp); + } else { + (void)ntpshm_pps(session, &tv); + } } else { gpsd_report(LOG_INF, "PPS pulse rejected\n"); } |