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
F168365587: D35935.id108535.diff
Thu, Aug 27, 7:21 PM
Unknown Object (File)
Sat, Aug 22, 12:15 PM
Unknown Object (File)
Fri, Aug 21, 11:00 AM
Unknown Object (File)
Fri, Aug 21, 11:00 AM
Unknown Object (File)
Tue, Aug 11, 9:20 PM
Unknown Object (File)
Tue, Aug 11, 4:05 PM
Unknown Object (File)
Sun, Aug 9, 4:18 PM
Unknown Object (File)
Sun, Aug 9, 2:54 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