ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Michal Schmidt d962ba
From 6840db7f47122699d420a80c2e6b6a34c7818759 Mon Sep 17 00:00:00 2001
Michal Schmidt d962ba
From: Miroslav Lichvar <mlichvar@redhat.com>
Michal Schmidt d962ba
Date: Wed, 27 Aug 2014 16:47:18 +0200
Michal Schmidt d962ba
Subject: [PATCH 03/12] timesyncd: fix calculation of transmit time
Michal Schmidt d962ba
Michal Schmidt d962ba
The kernel timestamp (recv_time) is made earlier than current time
Michal Schmidt d962ba
(now_ts), use the timestamp captured before sending packet directly.
Michal Schmidt d962ba
Michal Schmidt d962ba
(cherry picked from commit 73c76e6330d31e1d04454fd7408dd56b4eedca9f)
Michal Schmidt d962ba
---
Michal Schmidt d962ba
 src/timesync/timesyncd-manager.c | 4 +---
Michal Schmidt d962ba
 1 file changed, 1 insertion(+), 3 deletions(-)
Michal Schmidt d962ba
Michal Schmidt d962ba
diff --git a/src/timesync/timesyncd-manager.c b/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
index 60f39c6..3339606 100644
Michal Schmidt d962ba
--- a/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
+++ b/src/timesync/timesyncd-manager.c
Michal Schmidt d962ba
@@ -500,7 +500,6 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
Michal Schmidt d962ba
                 .msg_namelen = sizeof(server_addr),
Michal Schmidt d962ba
         };
Michal Schmidt d962ba
         struct cmsghdr *cmsg;
Michal Schmidt d962ba
-        struct timespec now_ts;
Michal Schmidt d962ba
         struct timeval *recv_time;
Michal Schmidt d962ba
         ssize_t len;
Michal Schmidt d962ba
         double origin, receive, trans, dest;
Michal Schmidt d962ba
@@ -613,8 +612,7 @@ static int manager_receive_response(sd_event_source *source, int fd, uint32_t re
Michal Schmidt d962ba
          *  The round-trip delay, d, and system clock offset, t, are defined as:
Michal Schmidt d962ba
          *  d = (T4 - T1) - (T3 - T2)     t = ((T2 - T1) + (T3 - T4)) / 2"
Michal Schmidt d962ba
          */
Michal Schmidt d962ba
-        assert_se(clock_gettime(clock_boottime_or_monotonic(), &now_ts) >= 0);
Michal Schmidt d962ba
-        origin = tv_to_d(recv_time) - (ts_to_d(&now_ts) - ts_to_d(&m->trans_time_mon)) + OFFSET_1900_1970;
Michal Schmidt d962ba
+        origin = ts_to_d(&m->trans_time) + OFFSET_1900_1970;
Michal Schmidt d962ba
         receive = ntp_ts_to_d(&ntpmsg.recv_time);
Michal Schmidt d962ba
         trans = ntp_ts_to_d(&ntpmsg.trans_time);
Michal Schmidt d962ba
         dest = tv_to_d(recv_time) + OFFSET_1900_1970;
Michal Schmidt d962ba
-- 
Michal Schmidt d962ba
2.1.0
Michal Schmidt d962ba