This patch uses a mnemonic to specify the request precision and also adds a
comment how a future implementation might pass along the actual system
wall clock precision.
---
src/ntp.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ntp.c b/src/ntp.c
index 3e90741..e15bd08 100644
--- a/src/ntp.c
+++ b/src/ntp.c
@@ -120,10 +120,17 @@ static void send_packet(int fd, const char *server)
struct sockaddr_in addr;
ssize_t len;
+ /*
+ * At some point, we could specify the actual system precision with:
+ *
+ * clock_getres(CLOCK_REALTIME, &ts);
+ * msg.precision = (int)log2(ts.tv_sec + (ts.tv_nsec * 1.0e-9));
+ */
memset(&msg, 0, sizeof(msg));
msg.flags = NTP_FLAGS_ENCODE(NTP_FLAG_LI_NOTINSYNC, 4,
NTP_FLAG_MD_CLIENT);
msg.poll = 4; // min
msg.poll = 10; // max
+ msg.precision = NTP_PRECISION_S;
memset(&addr, 0, sizeof(addr));
addr.sin_family = AF_INET;
--
1.7.10
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman