summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--libgpsd_core.c13
2 files changed, 12 insertions, 3 deletions
diff --git a/configure.ac b/configure.ac
index f448f01b..9281214b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -686,6 +686,8 @@ AC_MSG_CHECKING([for PPS time syncing support])
if test x"$ac_pps" = "xyes"; then
AC_MSG_RESULT([yes])
AC_DEFINE([PPS_ENABLE], 1, [PPS time syncing support])
+ AC_CHECK_HEADERS(pps.h)
+ dnl timepps.h needs pps.h
AC_CHECK_HEADERS(timepps.h)
else
AC_MSG_RESULT([no])
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 1cef6f87..589be08f 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -257,6 +257,7 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
gpsd_report(LOG_PROG, "PPS Create Thread gpsd_ppsmonitor\n");
#if defined(HAVE_TIMEPPS_H)
+ int kpps_edge = 0; /* 0 = assert edge, 1 = clear edge */
pps_info_t pi;
int kernelpps_handle = init_kernel_pps( session );
if ( 0 <= kernelpps_handle ) {
@@ -429,9 +430,15 @@ static /*@null@*/ void *gpsd_ppsmonitor(void *arg)
if (0 != ok) {
#if defined(HAVE_TIMEPPS_H)
if ( 0 <= kernelpps_handle ) {
- /* ntpshm_pps() expects usec, not nsec */
- pi.clear_timestamp.tv_nsec /= 1000;
- (void)ntpshm_pps(session, (struct timeval*)&pi.clear_timestamp);
+ /* pick the right edge */
+ if ( kpps_edge ) {
+ /* ntpshm_pps() expects usec, not nsec */
+ pi.clear_timestamp.tv_nsec /= 1000;
+ (void)ntpshm_pps(session, (struct timeval*)&pi.clear_timestamp);
+ } else {
+ pi.assert_timestamp.tv_nsec /= 1000;
+ (void)ntpshm_pps(session, (struct timeval*)&pi.assert_timestamp);
+ }
} else
#endif
(void)ntpshm_pps(session, &tv);