Versions Compared

Key

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

...

Anchor10554741055474 Clk_TS_UnixToTS() Anchor10554751055475Convert Unix timestamp to Clock timestamp. Anchor10554761055476

Files

...

clk.h/clk.c

...

...

Prototype

1056650

                              CLK_TS_SEC   ts_unix_sec);
tr
HTML Tablecode
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan5
Anchor
1056650
languagecpp
CPU_BOOLEAN  Clk_TS_UnixToTS (CLK_TS_SEC  *p_ts_sec,
Anchor
10554801055480
Table Row (tr)
Table Row (tr)
Table Row (tr)

...


...

Arguments

...

p_ts_sec

Pointer to variable that will receive the Clock timestamp:

...

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

Anchor10554911055491ts_unix_sec

Unix timestamp value to convert (in seconds, UTC+00).

...

Returned Values

...

10567391056739DEF_OK, if timestamp successfully converted. Anchor

10554931055493DEF_FAIL, otherwise. Anchor10554941055494

Required Configuration

...

10617351061735Available only if CLK_CFG_UNIX_EN is DEF_ENABLED in clk_cfg.h (see section 3-1-1 Module Configuration). Anchor10554961055496

Notes / Warnings

...

10697061069706Returned timestamp does not include any time zone offset. Thus any local time zone offset should be applied before or after calling Clk_TS_UnixToTS().anchor10697071069707

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. Anchor10555151055515 Example Usage

...

classCode_Listing

...

rowspan8

...

Example Usage

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


CLK_TS_SEC   ts_unix_sec
;
CPU_BOOLEAN
valid;  
  valid;
 
ts_unix_sec = 1000000;
valid =

valid       = Clk_TS_UnixToTS(&ts_sec, ts_unix_sec);
if

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

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

}
Code Block
languagecpp
titleListing - Clk_TS_UnixToTS() Example Usage
linenumberstrue
CLK_TS_SEC   ts_sec;
Anchor
10567581056758
Anchor
10567591056759
Anchor
10567611056761
Anchor
10567621056762
Anchor
10567631056763
Anchor
10567641056764
Anchor
10567651056765
Anchor
10567661056766
Anchor
10567671056767
Anchor
10555001055500
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)
Table Row (tr)