zephyr/samples/net/sockets/sntp_client
Aurelien Jarno 4394601524 net: sntp: get rid of the callback function
The original SNTP client library was designed for the net-app API, for
which it makes sense to have a callback function, which is called
asynchronously when an answer is received.

For the socket based interface, the callback is called just before
sntp_request() returns. It gets the status and the epoch_time in
parameter, however the status is already returned by sntp_request(). It
therefore make sense to replace the callback function by a pointer to
epoch_time.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-01-31 10:14:12 +02:00
..
src
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _sntp-client-sample:

SNTP client sample
##################

Overview
********

This sample is a simple SNTP client showing how to retrieve the current
time in seconds since 1st January 1970.

This demo assumes that the platform of choice has networking support,
some adjustments to the configuration may be needed. It also assumes
SNTP server is running on the host.

Building and Running
********************

When the application runs, it issues an SNTP request to the host and waits
for a response. When the response is received, the current epoch time, in
seconds, as well as the status code of the response (0 on success), is
printed.

See the `net-tools`_ project for more details.

This sample can be built and executed on QEMU as described
in :ref:`networking_with_qemu`.

.. _`net-tools`: https://github.com/zephyrproject-rtos/net-tools