Clk_IsDateTimeValid

Determine if date/time structure is valid in Clock epoch.

Files

clk.h/clk.c

Prototype

CPU_BOOLEAN  Clk_IsDateTimeValid (CLK_DATE_TIME  *p_date_time);


Arguments

p_date_time

Pointer to variable that contains the date/time structure to validate.

Returned Values

DEF_YES, if date/time structure is valid.

DEF_NO, otherwise.

Required Configuration

None.

Notes / Warnings

Date/time structure (p_date_time) must be representable in Clock timestamp. Thus date to validate must be greater than or equal to CLK_EPOCH_YR_START and less than CLK_EPOCH_YR_END.

Example Usage

Listing - Clk_IsDateTimeValid() 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_IsDateTimeValid(&date_time);
if (valid == DEF_OK) {
    printf("Date/time is valid");
} else {
    printf("Date/time is NOT valid");
}