6003927ac2
SNTP response is not analyzed for uncertainty, and no uncertainty is given to the `struct sntp_time` returned. Fix it with a Kconfig option that adds optional SNTP uncertainty and timestamp fields in SNTP time struct, and calculates these when parsing the response. Adds two helper functions to convert Q16.16/Q32.32 in seconds to `int64_t` in microseconds to facilitate this. Also changes combined `lvm` field in `struct sntp_pkt` to bit-fields `li`, `vn`, and `mode`. Signed-off-by: Jasper Smit <git@jrhrsmit.nl>
29 lines
825 B
Plaintext
29 lines
825 B
Plaintext
# Copyright (c) 2017 Linaro Limited
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
menuconfig SNTP
|
|
bool "SNTP (Simple Network Time Protocol)"
|
|
depends on NET_SOCKETS
|
|
help
|
|
Enable SNTP client library
|
|
|
|
if SNTP
|
|
|
|
config SNTP_UNCERTAINTY
|
|
bool "Calculate SNTP uncertainty and set uptime timestamp"
|
|
help
|
|
Get a more reliable timestamp by supplying the sntp_time struct with an
|
|
uptime timestamp of when the time was valid and an uncertainty of the
|
|
time in microseconds. Time is then given as:
|
|
seconds,fraction +/- uncertainty at uptime timestamp.
|
|
Enabling this option uses more resources (memory) and is not normally
|
|
needed.
|
|
|
|
module = SNTP
|
|
module-dep = NET_LOG
|
|
module-str = Log level for SNTP
|
|
module-help = Enable debug message of SNTP client library.
|
|
source "subsys/net/Kconfig.template.log_config.net"
|
|
|
|
endif # SNTP
|