Clk_SetDateTime
Set Clock timestamp from a date/time structure.
Files
clk.h/clk.c
Prototype
CPU_BOOLEAN Clk_SetDateTime (CLK_DATE_TIME *p_date_time);
Arguments
p_date_time
Pointer to variable that contains the date/time structure.
Returned Values
DEF_OK, if Clock timestamp is successfully set.
DEF_FAIL, otherwise.
Required Configuration
None.
Notes / Warnings
Date/time (p_date_time) should be set to local time with correct time zone offset (p_date_time->TZ_sec). Clk_SetDateTime() removes the time zone offset from the date/time to calculate the Clock timestamp as UTC+00.
Internal Clock time zone is set to the local time zone offset (p_date_time->TZ_sec).
Example Usage
Listing - Clk_SetDateTime() Example Usage
CLK_DATE_TIME date_time;
CPU_BOOLEAN valid;
date_time.Yr = 2010; /* 2010/09/18 11:11:11 UTC-05:00 */
date_time.Month = 9;
date_time.Day = 18;
date_time.Hr = 11;
date_time.Min = 11;
date_time.Sec = 11;
date_time.DayOfWk = 2;
date_time.DayOfYr = 291;
date_time.TZ_sec = -18000;
valid = Clk_SetDateTime(&date_time);
if (valid == DEF_OK) {
printf("Date/time successfully set");
} else {
printf("Clock Set Date/time error\n\r");
}
, multiple selections available,