Subject: code review: PPSAPI, timespec(nanoseconds) vs timeval(microseconds)
To: None <tech-kern@netbsd.org>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: tech-kern
Date: 10/12/1999 23:45:33
the following diff fixes what looks like a cut-and-paste glitch from
the TIOCDCDTIMESTAMP code. If the PPSAPI specified that a
user-specified offset be added to a timestamp, the kernel code
converted the timestamp (which was just converted from microsecond
resolution to nanosecond) back to microseconds.
Anyone see a problem in committing the diff?
Index: com.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/com.c,v
retrieving revision 1.161
diff -w -u -r1.161 com.c
--- com.c 1999/04/19 19:27:31 1.161
+++ com.c 1999/10/13 06:41:38
@@ -2032,7 +2032,6 @@
timespecadd(&sc->ppsinfo.assert_timestamp,
&sc->ppsparam.assert_offset,
&sc->ppsinfo.assert_timestamp);
- TIMESPEC_TO_TIMEVAL(&tv, &sc->ppsinfo.assert_timestamp);
}
#ifdef PPS_SYNC
@@ -2053,7 +2052,6 @@
timespecadd(&sc->ppsinfo.clear_timestamp,
&sc->ppsparam.clear_offset,
&sc->ppsinfo.clear_timestamp);
- TIMESPEC_TO_TIMEVAL(&tv, &sc->ppsinfo.clear_timestamp);
}
#ifdef PPS_SYNC
Index: z8530tty.c
===================================================================
RCS file: /cvsroot/syssrc/sys/dev/ic/z8530tty.c,v
retrieving revision 1.60
diff -w -u -r1.60 z8530tty.c
--- z8530tty.c 1999/04/22 20:37:37 1.60
+++ z8530tty.c 1999/10/13 06:42:17
@@ -1487,8 +1487,6 @@
timespecadd(&zst->ppsinfo.assert_timestamp,
&zst->ppsparam.assert_offset,
&zst->ppsinfo.assert_timestamp);
- TIMESPEC_TO_TIMEVAL(&tv,
- &zst->ppsinfo.assert_timestamp);
}
#ifdef PPS_SYNC
@@ -1506,8 +1504,6 @@
if (zst->ppsparam.mode & PPS_OFFSETCLEAR) {
timespecadd(&zst->ppsinfo.clear_timestamp,
&zst->ppsparam.clear_offset,
- &zst->ppsinfo.clear_timestamp);
- TIMESPEC_TO_TIMEVAL(&tv,
&zst->ppsinfo.clear_timestamp);
}