Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10511561051156 Clk_GetTS_NTP() Anchor10511571051157Get current Clock timestamp as an NTP timestamp.anchor10511581051158

Files

...

clk.h/clk.c

...

Prototype

HTML Tablecode
Table Cell (td)
rowspan5
Anchor
10511621051162
classlanguageCode_Listing
Table Row (tr)
cpp
CPU_BOOLEAN  Clk_GetTS_NTP (CLK_TS_SEC  *p_ts_ntp_sec);
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)

...

...


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

Anchor10532861053286DEF_OK, if current timestamp is successfully converted. Anchor10511751051175

DEF_FAIL, otherwise. Anchor10511761051176

Required Configuration

Anchor10511771051177Available only if CLK_CFG_NTP_EN is DEF_ENABLED in clk_cfg.h (see section 3-1-1 Module Configuration). Anchor10511781051178

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(). Anchor10684561068456

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

...

rowspan8

...

Anchor
10511971051197Listing - Clk_GetTS_NTP() Example Usage

...

classCode_Listing

Listing - Clk_GetTS_NTP() Example Usage


CPU_BOOLEAN
valid;   valid =
  valid;
 
valid = Clk_GetTS_NTP(&ts_ntp_sec);
if

if (valid == DEF_OK)
{
 {
    printf("Timestamp NTP = %u", ts_ntp_sec);
} else {

} else {
    printf("Get TS NTP error\n\r");
}tr

}
Code Block
languagecpp
titleListing - Clk_GetTS_NTP() Example Usage
linenumberstrue
CLK_TS_SEC   ts_ntp_sec;
Anchor
10533241053324
Anchor
10533381053338
Anchor
10533521053352
Anchor
10533911053391
Anchor
10533921053392
Anchor
10533931053393
Anchor
10533941053394
Anchor
10533831053383
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)