Versions Compared

Key

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

...

Files

clk.h/clk.c

Prototype

Code Block
languagecpp
CPU_BOOLEAN  Clk_TS_UnixToTS (CLK_TS_SEC  *p_ts_sec,
                              CLK_TS_SEC   ts_unix_sec);


Arguments

p_ts_sec

Pointer to variable that will receive the Clock timestamp:

...

Only years supported by Clock and Unix can be converted, thus the timestamp date must be greater than or equal to CLK_EPOCH_YR_START and less than CLK_UNIX_EPOCH_YR_END.

Example Usage

Anchor
Listing - Clk_TS_UnixToTS() Example Usage
Listing - Clk_TS_UnixToTS() Example Usage

Code Block
languagecpp
titleListing - Clk_TS_UnixToTS() Example Usage
linenumberstrue
CLK_TS_SEC   ts_sec;
CLK_TS_SEC   ts_unix_sec;
CPU_BOOLEAN  valid;
 
ts_unix_sec = 1000000;
valid       = Clk_TS_UnixToTS(&ts_sec, ts_unix_sec);
if (valid == DEF_OK) {
    printf("Timestamp = %u", ts_sec);
} else {
    printf("Convert timestamp error\n\r");
}