Changeset d5c386f in rtems


Ignore:
Timestamp:
02/27/23 21:49:10 (12 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
1a4e78b3
Parents:
d9f5345
git-author:
Sebastian Huber <sebastian.huber@…> (02/27/23 21:49:10)
git-committer:
Sebastian Huber <sebastian.huber@…> (03/07/23 06:30:44)
Message:

pps: Round to closest integer in pps_event()

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 delta_nsec value is a time difference and not a timestamp. Also
the rounding errors accumulate in the frequency accumulator, see hardpps().
So, rounding to the closest integer is probably slightly better.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/604

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/src/kern_tc.c

    rd9f5345 rd5c386f  
    22672267        if (fhard) {
    22682268                uint64_t delta_nsec;
     2269                uint64_t freq;
    22692270
    22702271                /*
     
    22782279                delta_nsec = 1000000000;
    22792280                delta_nsec *= tcount;
    2280                 delta_nsec /= captc->tc_frequency;
     2281                freq = captc->tc_frequency;
     2282                delta_nsec = (delta_nsec + freq / 2) / freq;
    22812283                hardpps(tsp, (long)delta_nsec);
    22822284        }
Note: See TracChangeset for help on using the changeset viewer.