Get current Clock timestamp as a date/time structure.
Files
clk.h/clk.c
Prototype
Code Block | ||
---|---|---|
| ||
CPU_BOOLEAN Clk_GetDateTime (CLK_DATE_TIME *p_date_time); |
Arguments
p_date_time
Pointer to variable that will receive the date/time structure.
Returned Values
DEF_OK
, if date/time structure is valid.
DEF_FAIL
, otherwise.
Required Configuration
None.
Notes / Warnings
Clock time zone offset is used to calculate the local date/time (p_date_time
) returned. Thus local date/time is returned as UTC+TZ, where Clock time zone offset (TZ) is returned as local time zone offset (p_date_time->TZ_sec
).
Example Usage
Anchor | ||||
---|---|---|---|---|
|
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
CLK_DATE_TIME date_time;
CPU_BOOLEAN valid;
valid = Clk_GetDateTime(&date_time);
if (valid == DEF_OK) {
printf("Time = %u:%u:%u\n\r", date_time.Hr, date_time.Min, date_time.Sec);
} else {
printf("Clock Get Date/time error\n\r");
} |