Skip to end of metadata
Go to start of metadata

This section describes the examples that are related to the Micrium OS SNTP Client module.

SNTP Client Initialization Example

Description

This is a generic example that shows how to initialize the SNTP client module. 

Configuration

Mandatory

The following #define must be added in ex_description.h to allow other examples to initialize the SNTP Client module correctly:

#defineDescription
EX_SNTP_CLIENT_INIT_AVAILLets the upper example layer know that the SNTP Client Initialization example is present and must be called by other examples.

Optional

The following #define can be added to ex_description.h, as described in Example Applications section, to change default configuration value used by the example:

#defineDefault valueDescription
EX_TRACE

printf(__VA_ARGS__)

Specify the function used to output information

Location

  • /examples/net/sntp/ex_sntp_client.c
  • /examples/net/sntp/ex_sntp_client.h

API

APIDescription

Ex_SNTP_Client_Init()

Initialize the Micrium OS SNTP Client module for the example application.

Notes

None.

Basic SNTP Current Time Retrieve

Description

This is a simple example that will retrieve the current time from the following NTP server: 0.pool.ntp.org.

The example will then display the current time in the following format:

Day <day> of year <year>. Time: hh:mm:ss(UTC)

Location

  • /examples/net/sntp/ex_sntp_client.c
  • /examples/net/sntp/ex_sntp_client.h

Configuration

Optional

The following #define can be added to ex_description.h, as described in Example Applications section, to change default configuration value used by the example:

#defineDefault valueDescription
EX_TRACE

printf(__VA_ARGS__)

Specify the function used to output information

API

APIDescription

Ex_SNTP_Client_CurTimeDisplay()

Retrieves the current time from the NTP server and displays it

Notes

None.