Versions Compared

Key

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

...

Anchor10512161051216 Clk_SetTS_NTP() Anchor10512171051217Set Clock timestamp from an NTP timestamp.anchor10512181051218

Files

...

clk.h/clk.c

...

...

Prototype

HTML Tablecode
Table Cell (td)
rowspan5
Anchor
10512221051222
classlanguageCode_Listing
Table Row (tr)
cpp
CPU_BOOLEAN  Clk_SetTS_NTP (CLK_TS_SEC  ts_ntp_sec);
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)

...

...


Arguments

...

ts_ntp_sec

Current NTP timestamp to set (in seconds, UTC+00).

...

...

Returned Values

...

DEF_OK, if timestamp is successfully set.anchor

10512351051235DEF_FAIL, otherwise. Anchor10615711061571

Required Configuration

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

Notes / Warnings

...

10684731068473Only years supported by Clock and NTP can be set, thus the timestamp date must be between greater than or equal to CLK_EPOCH_YR_START and less than CLK_NTP_EPOCH_YR_END. Anchor10512571051257 Example Usage

...

classCode_Listing

...

rowspan8

...

Example Usage

Anchor
Listing - Clk_SetTS_NTP() Example Usage
Listing - Clk_SetTS_NTP() Example Usage


CPU_BOOLEAN
valid;  
  valid;
 
ts_ntp_sec =
20200020; valid =
 3158880000;
valid      = Clk_SetTS_NTP(
&
ts_ntp_sec);
if

if (valid == DEF_OK)
{
 {
    printf("Timestamp successfully set");
} else {

} else {
    printf("Set timestamp error\n\r");
}tr

}
Code Block
languagecpp
titleListing - Clk_SetTS_NTP() Example Usage
linenumberstrue
CLK_TS_SEC   ts_ntp_sec;
Anchor
10536361053636
Anchor
10536431053643
Anchor
10536501053650
Anchor
10536851053685
Anchor
10537431053743
Anchor
10537441053744
Anchor
10537451053745
Anchor
10537461053746
Anchor
10536571053657
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)