MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / is_valid_date

Function is_valid_date

components/drivers/rtc/dev_alarm.c:345–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343}
344
345static rt_bool_t is_valid_date(struct tm *date)
346{
347 if ((date->tm_year < 0) || (date->tm_year > RT_RTC_YEARS_MAX))
348 {
349 return (RT_FALSE);
350 }
351
352 if ((date->tm_mon < 0) || (date->tm_mon > 11))
353 {
354 return (RT_FALSE);
355 }
356
357 if ((date->tm_mday < 1) || \
358 (date->tm_mday > days_of_year_month(date->tm_year, date->tm_mon)))
359 {
360 return (RT_FALSE);
361 }
362
363 return (RT_TRUE);
364}
365
366static rt_err_t alarm_setup(rt_alarm_t alarm, struct tm *wktime)
367{

Callers 1

alarm_setupFunction · 0.85

Calls 1

days_of_year_monthFunction · 0.85

Tested by

no test coverage detected