Page MenuHomeFreeBSD

pps: Round to closest integer in pps_event()
AcceptedPublic

Authored by sebastian.huber_embedded-brains.de on Jul 26 2022, 8:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 2 2024, 4:34 PM
Unknown Object (File)
Oct 2 2024, 4:34 PM
Unknown Object (File)
Oct 2 2024, 4:19 PM
Unknown Object (File)
Sep 30 2024, 11:21 AM
Unknown Object (File)
Sep 28 2024, 3:31 PM
Unknown Object (File)
Sep 28 2024, 6:52 AM
Unknown Object (File)
Sep 25 2024, 9:20 AM
Unknown Object (File)
Sep 25 2024, 6:28 AM

Details

Reviewers
phk
gnn
delphij
imp
Summary

The comment above bintime2timespec() says:

When converting between timestamps on parallel timescales of differing
resolutions it is historical and scientific practice to round down.

However, the nsec value is a time difference and not a timestamp. So, rounding
to the closest integer is probably slightly better.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 46582
Build 43471: arc lint + arc unit

Event Timeline

My quick algebra says this is good and computed in the right way.

sys/kern/kern_tc.c
1898

so we go from nsec = nsec / freq to nsec = (nsec + freq / 2) / freq which is nsec / freq + freq / (2 * freq) or nsec / freq + 1/2 which looks good.

This revision is now accepted and ready to land.Jul 26 2022, 3:34 PM