Clk_SetTS_Unix
Set Clock timestamp from a Unix timestamp.
Files
clk.h/clk.c
Prototype
CPU_BOOLEAN Clk_SetTS_Unix (CLK_TS_SEC ts_unix_sec);Arguments
ts_unix_sec Current Unix timestamp to set (in seconds, UTC+00).
Returned Values
DEF_OK, if timestamp successfully set.
DEF_FAIL, otherwise.
Required Configuration
Available only if CLK_CFG_UNIX_EN is DEF_ENABLED in clk_cfg.h (see Module Configuration).
Notes / Warnings
Only years supported by Clock and Unix can be set, thus the timestamp date must be between greater than or equal to CLK_EPOCH_YR_START and less than CLK_UNIX_EPOCH_YR_END.
Example Usage
Listing - Clk_SetTS_Unix() Example Usage
CLK_TS_SEC ts_unix_sec;
CPU_BOOLEAN valid;
ts_unix_sec = 968004900;
valid = Clk_SetTS_Unix(ts_unix_sec);
if (valid == DEF_OK) {
printf("Timestamp successfully set");
} else {
printf("Set timestamp error\n\r");
}