The time value passed into the leap second lookup table should be in
seconds, but the calling code in the nmea module passes nanoseconds
instead.  This patch fixes the issue by converting the time value
accordingly.

Signed-off-by: Richard Cochran <richardcoch...@gmail.com>
---
 lstab.h              | 2 +-
 ts2phc_nmea_master.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lstab.h b/lstab.h
index 7c5d918..d2393b4 100644
--- a/lstab.h
+++ b/lstab.h
@@ -54,7 +54,7 @@ enum lstab_result {
 /**
  * Returns the TAI - UTC offset for a given UTC time value.
  * @param lstab       A pointer obtained via lstab_create().
- * @param utctime     The UTC time value of interest.
+ * @param utctime     The UTC time value of interest, in seconds.
  * @param tai_offset  Pointer to a buffer to hold the result.
  * @return            One of the lstab_result enumeration values.
  */
diff --git a/ts2phc_nmea_master.c b/ts2phc_nmea_master.c
index 2b9af3b..b217703 100644
--- a/ts2phc_nmea_master.c
+++ b/ts2phc_nmea_master.c
@@ -181,6 +181,7 @@ static int ts2phc_nmea_master_getppstime(struct 
ts2phc_master *master,
        //
        rmc = tmv_add(rmc, tmv_sub(local_t2, local_t1));
        utc_time = tmv_to_nanoseconds(rmc);
+       utc_time /= (int64_t) 1000000000;
        *ts = tmv_to_timespec(rmc);
 
        result = lstab_utc2tai(m->lstab, utc_time, &tai_offset);
-- 
2.20.1



_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to