coreSNTP  v1.0.0
Client library for synchronizing device time with internet time using Simple Network Time Protocol (SNTP)

coreSNTP Library

The coreSNTP library provides a client for the Simple Network Time Protocol (SNTP) to allow devices to synchronize their system clocks with internet time. This library implements the SNTPv4 specification defined in RFC 4330.

An SNTP client can request time from both NTP and SNTP servers. According to the SNTPv4 specification,

To an NTP or SNTP server, NTP and SNTP clients are indistinguishable; to an NTP or SNTP client, NTP and SNTP servers are indistinguishable.


This library is optimized for resource constrained embedded devices. Features of this library include:

  • Fully synchronous API, to allow applications to completely manage their concurrency and multi-threading method.
  • Operations on fixed buffers, so that applications may control their memory allocation strategy.
  • Flexibility to develop an application with either:
    • The serializer/de-serializer API which allows complete control over the operations of the SNTP client. OR
    • The client API that handles operations of communicating over the network, performing authentication, and handling rejected server responses.

Memory Requirements

Memory requirements of the coreSNTP library.

Code Size of coreSNTP (example generated with GCC for ARM Cortex-M)
With -O1 Optimization
With -Os Optimization
Total estimates


coreSNTP Library Design

The coreSNTP library provides 2 API layers:

  1. Serializer/Deserializer and Utilities - This layer provides functionality for serializing SNTP time requests and deserializing SNTP response packets, as well as some utility functions helpful in setting up an SNTP client in an application.
  2. Client - This layer provides managed functionality for network operations including DNS resolution, sending and receiving SNTP packets over UDP, authenticating servers for security (if enabled), and handling of server rejection of time requests. Note**: This client API layer performs network and authentication operations through user-defined implementation of interfaces exposed by the library.

Following is the architecture diagram of the library. It showcases the 2 tiers of the library and the interfaces on which the Managed Client layer depends on.

Interfaces and Callbacks

As visible in the above architecture diagram, the Managed Client API layer depends on the following interfaces that are user-defined for platform-specific operations:

  • DNS Resolve Interface - This allows library to resolve DNS addresses of time servers by the application.
  • UDP Transport Interface - This allows library to send and receive SNTP packets over network UDP layer to communicate with SNTP/NTP servers.
  • Get Time Interface - This allows library to obtain system time for tracking timeouts as well as creating SNTP time requests.
  • Set Time Interface - This allows library to notify application about updating system time with the latest time provided by server as well as the system clock drift calculated by library.
  • Authentication Interface (Optional) - This allows library to perform mutual authentication in communicating with time servers for security. It is RECOMMENDED that applications enable authentication when communicating with time servers.