Versions Compared

Key

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

Set External timestamp.

Files

clk.h / Application’s source file

Called from

  Clk_SetTS()

Prototype

Code Block
languagecpp
CPU_BOOLEAN  Clk_ExtTS_Set (CLK_TS_SEC  ts_sec);


Arguments

ts_sec

External timestamp value to set (in seconds, UTC+00).

Returned Values

DEF_OK, if External timestamp succesfully set;

DEF_FAIL, otherwise.

Required Configuration

Required callback function that must be implemented in your application if CLK_CFG_EXT_EN is DEF_ENABLED in clk_cfg.h (see Module Configuration) in order for the clock/calendar to be maintained by an external clock/timestamp mechanism.

Notes / Warnings

External timestamp values are converted from Clock timestamp’s CLK_TS_SEC data type. If the External timestamp has more bits than the CLK_TS_SEC data type, Clk_ExtTS_Set() must pad the External timestamp’s higher order bits with 0 bits. If the External timestamp has less bits than the CLK_TS_SEC data type, Clk_ExtTS_Set() must truncate the Clock timestamp’s higher order bits greater than the External timestamp.

...

This example underflows to a negative External timestamp since the equivalent date to convert is incorrectly less than the External epoch start year.

Example Template

Anchor
Listing - Clk_ExtTS_Set() Example Template
Listing - Clk_ExtTS_Set() Example Template

Code Block
languagecpp
titleListing - Clk_ExtTS_Set() Example Template
linenumberstrue
CPU_BOOLEAN  Clk_ExtTS_Set (CLK_TS_SEC  ts_sec)
{
    BSP_ClockSetTS(ts_sec);
    return (DEF_OK);
}