summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiroslav Lichvar <mlichvar@redhat.com>2014-08-27 16:47:18 +0200
committerKay Sievers <kay@vrfy.org>2014-08-29 18:13:02 +0200
commit73c76e6330d31e1d04454fd7408dd56b4eedca9f (patch)
treeda798d39f7118e9962f54eaa1d40b71dba6a78c2 /src
parent07610e108e2d3f046da683a3a69c4d5cccd2cf8e (diff)
timesyncd: fix calculation of transmit time
The kernel timestamp (recv_time) is made earlier than current time (now_ts), use the timestamp captured before sending packet directly.
Diffstat (limited to 'src')
-rw-r--r--src/timesync/timesyncd-manager.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
index 60f39c638d..333960669c 100644
--- a/src/timesync/timesyncd-manager.c
+++ b/src/timesync/timesyncd-manager.c
@@ -500,7 +500,6 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
.msg_namelen = sizeof(server_addr),
};
struct cmsghdr *cmsg;
- struct timespec now_ts;
struct timeval *recv_time;
ssize_t len;
double origin, receive, trans, dest;
@@ -613,8 +612,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
* The round-trip delay, d, and system clock offset, t, are defined as:
* d = (T4 - T1) - (T3 - T2) t = ((T2 - T1) + (T3 - T4)) / 2"
*/
- assert_se(clock_gettime(clock_boottime_or_monotonic(), &now_ts) >= 0);
- origin = tv_to_d(recv_time) - (ts_to_d(&now_ts) - ts_to_d(&m->trans_time_mon)) + OFFSET_1900_1970;
+ origin = ts_to_d(&m->trans_time) + OFFSET_1900_1970;
receive = ntp_ts_to_d(&ntpmsg.recv_time);
trans = ntp_ts_to_d(&ntpmsg.trans_time);
dest = tv_to_d(recv_time) + OFFSET_1900_1970;