serialqueue: Take baud_adjust into account when calculating receive_time

Use baud_adjust when determining the receive_time of a message read
from the serial port.  This improves the accuracy of the clock
synchronization code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-09-26 21:47:13 -04:00
parent d9fe4b6944
commit 3982b5030e
1 changed files with 1 additions and 0 deletions

View File

@ -519,6 +519,7 @@ handle_message(struct serialqueue *sq, double eventtime, int len)
struct queue_message *qm = message_fill(sq->input_buf, len);
qm->sent_time = sq->last_receive_sent_time;
qm->receive_time = get_monotonic(); // must be time post read()
qm->receive_time -= sq->baud_adjust * len;
list_add_tail(&qm->node, &sq->receive_queue);
check_wake_receive(sq);
}