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)
Jan 30 2024, 1:11 AM
Unknown Object (File)
Dec 22 2023, 11:53 PM
Unknown Object (File)
Dec 12 2023, 8:55 PM
Unknown Object (File)
Nov 19 2023, 1:51 AM
Unknown Object (File)
Nov 19 2023, 1:43 AM
Unknown Object (File)
Nov 19 2023, 1:41 AM
Unknown Object (File)
Nov 13 2023, 4:10 AM
Unknown Object (File)
Sep 26 2023, 8:51 PM

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