Skip to main content
  • Products
  • Evaluate our Software
  • Downloads
  • Free Utilities
  • Purchase
  • Support
  • About Us
  • Blog
  • Forum
  • Search
    • Contact Us
    • Forum
    • Knowledge Base
    • Web Shop
    • Newsletter
    • RSS
  •   Jobs
  •   Videos
  •   Blog
  •   Sustainability
  • emNet
  • NTP Client
  • Technology
  • Add-Ons
  • Tools

NTP client

The emNet Network Time Protocol (NTP) client is an optional extension which can be seamlessly integrated into your application. The NTP client implementation allows an embedded system to use real timestamps from a remote NTP server without using a Real Time Clock (RTC).

Contact us
Downloads
Documentation
SEGGER emNet
  1. 1.Overview
    1. 1.1.Key features
  2. 2.NTP background
  3. 3.Requirements
  4. 4.Configuration
  5. 5.Resource usage
  6. 6.Relevant parts

Overview

The NTP protocol is a service on top of the UDP/IP protocol. It provides a way of synchronizing the target time with a local or remote NTP server over the network.

NTP client application layer

Key features

  • Low memory footprint
  • Seamless integration with the emNet stack
  • Time synchronization with local and remote NTP clocks

NTP background

Using NTP, an emNet based application can use an accurate time obtained from NTP servers. These NTP servers could be in local network and in global network.

To obtain the IP address of clocks in the global network, the NTP client could be configured by the user with IPv4 or IPv6 addresses and/or use a server pool.

When using server pools, the NTP client performs a DNS request with a server pool name (for example "0.pool.ntp.org") and will get a reply with the IP addresses of some clocks. Once the clock IP addresses are obtained, the NTP client sends synchronization requests to all clocks (through a gateway for clocks in the global network) and uses their replies to compute the time offset.

NTP-client-env

Synchronization messages sent between the client and server clocks contain time information exchange. The clients send a request with a timestamp. The server stores the time of the request arrival and send it back along with its sending time. The client stores the time of the reply arrival and can compute the time offset with the four known times.

csm NTP Client Message

Requirements

The emNet NTP client implementation requires the emNet TCP/IP stack.
In order to use a server pool, a DNS environment needs to be present and configured.

Configuration

The emNet NTP client has some parameters for its configuration. These parameters are per default set with valid values.

The maximum number of server pools and monitored clock could be modified:

#define NTP_MAX_POOL     4  // Maximum number of configured pools.
#define NTP_MAX_SERVER   8  // Maximum number of monitored servers.

The NTP version 4 specification requires to keep for each monitored clocks lots of data in memory and have quite a complex processing. The emNet NTP implements this algorithm but also provides a simpler one which requires fewer resources. This could be chosen with a compilation switch:

#define NTP_USE_SIMPLER_VERSION 1  // Don't follow strictly RFC but use much fewer resources.

Resource usage

The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements of the NT client presented in the tables below have been measured on a Cortex-M4 with the default configuration.

ROM Usage

ROM measured on a Cortex-M4 system using SEGGER Embedded Studio, size optimized.

Add-onROM
emNet NTP client simpler processingApproximately 3.1 KByte
emNet NTP client full RFCApproximately 4.5 KByte

RAM Usage

RAM given with the default configuration: maximum 8 servers and 4 pools.

Add-onRAM
emNet NTP client simpler processingApproximately 0.6 KByte
emNet NTP client full RFCApproximately 3.2 KByte

Relevant parts

The NTP client implements the relevant parts of the NTP v4 Request For Comments (RFC).

RFC#Description
[RFC 5905]Direct Link: Network Time Protocol Version 4: Protocol and Algorithms Specification

Headquarters

SEGGER Microcontroller GmbH

Ecolab-Allee 5
40789 Monheim am Rhein, Germany
info@segger.com
Tel.: +49-2173-99312-0
Fax: +49-2173-99312-28

Locations

USA: SEGGER Microcontroller Systems LLC

Boston area
101 Suffolk Lane
Gardner, MA 01440, USA
us-east@segger.com
Tel.: +1-978-874-0299
Fax: +1-978-874-0599

Silicon Valley
Milpitas, CA 95035, USA
us-west@segger.com
Tel.: +1-408-767-4068

China: SEGGER Microcontroller China Co., Ltd.

Room 218, Block A, Dahongqiaoguoji
No. 133 Xiulian Road
Minhang District, Shanghai 201199, China
china@segger.com
Tel.: +86-133-619-907-60

ISO 9001 certified

ISO 9001

30+ years of experience

First-class embedded software tools since 1992
  • Imprint
  • Disclaimer
  • Privacy Policy
© 2025 SEGGER - All rights reserved.