net: lib: ptp: Fix bidir time adjustment
When the offset is larger than 1 second, the time adjustment should still be allowed to be bidirectional. Casting the offset to an unsigned value after the subtraction will allow the adjustment to be bidirectional. Signed-off-by: Tomas Choat <trc@ixys.no>
This commit is contained in:
parent
ecfc44469c
commit
b3505fbaa6
1 changed files with 2 additions and 2 deletions
|
@ -529,8 +529,8 @@ void ptp_clock_synchronize(uint64_t ingress, uint64_t egress)
|
|||
|
||||
ptp_clock_get(ptp_clk.phc, ¤t);
|
||||
|
||||
current.second -= (uint64_t)(offset / NSEC_PER_SEC);
|
||||
dest_nsec = (int32_t)(current.nanosecond - (uint32_t)(offset % NSEC_PER_SEC));
|
||||
current.second = (uint64_t)(current.second - (offset / NSEC_PER_SEC));
|
||||
dest_nsec = (int32_t)(current.nanosecond - (offset % NSEC_PER_SEC));
|
||||
|
||||
if (dest_nsec < 0) {
|
||||
current.second--;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue