diff options
author | Grant Erickson <marathon96@gmail.com> | 2012-07-16 09:48:04 -0700 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-07-17 10:13:43 +0200 |
commit | 6f0080f148b1f5555e1be9db7536bdbad2f48642 (patch) | |
tree | 1b49dd1048d7fc8c7f69809a07ef984f363e0f30 /src/ntp.c | |
parent | d00cbbd3b0aa78b2464153681ae37f10a9acaa48 (diff) | |
download | connman-6f0080f148b1f5555e1be9db7536bdbad2f48642.tar.gz connman-6f0080f148b1f5555e1be9db7536bdbad2f48642.tar.bz2 connman-6f0080f148b1f5555e1be9db7536bdbad2f48642.zip |
ntp: Use mnemonic when specifying the request precision
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.
Diffstat (limited to 'src/ntp.c')
-rw-r--r-- | src/ntp.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -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; |