#16 Incorrect one_way_delay calculation

closed
None
5
2011-02-02
2010-10-18
Anonymous
No

There is an arror in in one_way_delay calculation in updateDelay() in
'src/dep/servo.c':

/* update 'one_way_delay' */
addTime(&ptpClock->one_way_delay, &ptpClock->master_to_slave_delay, &ptpClock->slave_to_master_delay);
ptpClock->one_way_delay.seconds /= 2;
ptpClock->one_way_delay.nanoseconds /= 2;

I mean the goal is to calculate

one\_way\_delay = \(master\_to\_slave\_delay + slave\_to\_master\_delay\) / 2.

But the code produces wrong result in some circumstances because division by
2 is coded incorrectly. For example, if one_way_delay.second==1 and
one_way_delay.nanoseconds=0 the result will be 0.0 instead of 0.5 sec. The
rigth result may be produced with (for example):

ptpClock->one_way_delay.nanoseconds += ptpClock->one_way_delay.seconds % 2 * 1000000000;
ptpClock->one_way_delay.seconds /= 2;
ptpClock->one_way_delay.nanoseconds /= 2;

Discussion

  • George Neville-Neil

    • assigned_to: nobody --> gnn
    • status: open --> closed-fixed
     
  • George Neville-Neil

    This is fixed by commit #122 on the main line, and commit #124 in the v2 branch.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks