forked from Imagelibrary/rtems
Clarify hardpps() parameter name and comment
Since 32c203577a5e by phk in 1999 (Make even more of the PPSAPI implementations generic), the "nsec" parameter of hardpps() is a time difference and no longer a time point. Change the name to "delta_nsec" and adjust the comment. Remove comment about a clock tick adjustment which is no longer in the code. Pull Request: https://github.com/freebsd/freebsd-src/pull/640 Reviewed by: imp
This commit is contained in:
@@ -862,11 +862,11 @@ hardupdate(offset)
|
|||||||
* variables, except for the actual time and frequency variables, which
|
* variables, except for the actual time and frequency variables, which
|
||||||
* are determined by this routine and updated atomically.
|
* are determined by this routine and updated atomically.
|
||||||
*
|
*
|
||||||
* tsp - time at PPS
|
* tsp - time at current PPS event
|
||||||
* nsec - hardware counter at PPS
|
* delta_nsec - time elapsed between the previous and current PPS event
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
hardpps(struct timespec *tsp, long nsec)
|
hardpps(struct timespec *tsp, long delta_nsec)
|
||||||
{
|
{
|
||||||
long u_sec, u_nsec, v_nsec; /* temps */
|
long u_sec, u_nsec, v_nsec; /* temps */
|
||||||
l_fp ftemp;
|
l_fp ftemp;
|
||||||
@@ -903,12 +903,9 @@ hardpps(struct timespec *tsp, long nsec)
|
|||||||
/*
|
/*
|
||||||
* Compute the difference between the current and previous
|
* Compute the difference between the current and previous
|
||||||
* counter values. If the difference exceeds 0.5 s, assume it
|
* counter values. If the difference exceeds 0.5 s, assume it
|
||||||
* has wrapped around, so correct 1.0 s. If the result exceeds
|
* has wrapped around, so correct 1.0 s.
|
||||||
* the tick interval, the sample point has crossed a tick
|
|
||||||
* boundary during the last second, so correct the tick. Very
|
|
||||||
* intricate.
|
|
||||||
*/
|
*/
|
||||||
u_nsec = nsec;
|
u_nsec = delta_nsec;
|
||||||
if (u_nsec > (NANOSECOND >> 1))
|
if (u_nsec > (NANOSECOND >> 1))
|
||||||
u_nsec -= NANOSECOND;
|
u_nsec -= NANOSECOND;
|
||||||
else if (u_nsec < -(NANOSECOND >> 1))
|
else if (u_nsec < -(NANOSECOND >> 1))
|
||||||
|
|||||||
Reference in New Issue
Block a user