Converts a date/time structure to an ASCII string.
Files
clk.h/clk.c
Prototype
Arguments
p_date_time
Pointer to variable that contains the date/time structure to convert.
fmt
Desired string format:
CLK_STR_FMT_YYYY_MM_DD_HH_MM_SS_UTC
CLK_STR_FMT_YYYY_MM_DD_HH_MM_SS
CLK_STR_FMT_MM_DD_YY_HH_MM_SS
CLK_STR_FMT_YYYY_MM_DD
CLK_STR_FMT_MM_DD_YY
CLK_STR_FMT_DAY_MONTH_DD_YYYY
CLK_STR_FMT_DAY_MONTH_DD_HH_MM_SS_YYYY
CLK_STR_FMT_HH_MM_SS
CLK_STR_FMT_HH_MM_SS_AM_PM
p_str
Pointer to variable that will receive the formated string.
str_len
Maximum number of characters the string can contains.
Returned Values
DEF_OK
, if string successfully returned.
DEF_FAIL
, otherwise.
Required Configuration
Available only if CLK_CFG_STR_CONV_EN
is DEF_ENABLED
in clk_cfg.h
(see section 3-1-1).
Notes / Warnings
It’s only possible to convert date supported by Clock:
- Earliest year is the NTP epoch start year, thus Year (
yr
) must be greater than or equal toCLK_NTP_EPOCH_YR_START
. - Latest year is the Clock epoch last year, thus Year (
yr
) must be less thanCLK_EPOCH_YR_END
.
The size of the string buffer that will receive the returned string address must be greater than or equal to CLK_STR_FMT_MAX_LEN
.