Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

Clk_GetTS_NTP()

Get current Clock timestamp as an NTP timestamp.

Files

clk.h/clk.c

Prototype

CPU_BOOLEAN Clk_GetTS_NTP (CLK_TS_SEC *p_ts_ntp_sec);

Arguments

p_ts_ntp_sec Pointer to variable that will receive the NTP timestamp:

In seconds UTC+00, if no errors;
CLK_TS_SEC_NONE, otherwise.

Returned Values

DEF_OK, if current timestamp is successfully converted.

DEF_FAIL, otherwise.

Required Configuration

Available only if CLK_CFG_NTP_EN is DEF_ENABLED in clk_cfg.h (see section 3-1-1).

Notes / Warnings

NTP timestamp does not include any time zone offset. Thus any local time zone offset must be applied after calling Clk_GetTS_NTP().

NTP timestamp will eventually overflow, thus it's not possible to get NTP timestamp for years on or after CLK_NTP_EPOCH_YR_END.

Example Usage

CLK_TS_SEC ts_ntp_sec;

CPU_BOOLEAN valid;

 

valid = Clk_GetTS_NTP(&ts_ntp_sec);

if (valid == DEF_OK) {

printf("Timestamp NTP = %u", ts_ntp_sec);

} else {

printf("Get TS NTP error\n\r");

}

  • No labels