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

Function days_of_year_month

components/drivers/rtc/dev_alarm.c:324–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static int days_of_year_month(int tm_year, int tm_mon)
325{
326 int ret, year;
327
328 year = tm_year + 1900;
329 if (tm_mon == 1)
330 {
331 ret = 28 + ((!(year % 4) && (year % 100)) || !(year % 400));
332 }
333 else if (((tm_mon <= 6) && (tm_mon % 2 == 0)) || ((tm_mon > 6) && (tm_mon % 2 == 1)))
334 {
335 ret = 31;
336 }
337 else
338 {
339 ret = 30;
340 }
341
342 return (ret);
343}
344
345static rt_bool_t is_valid_date(struct tm *date)
346{

Callers 1

is_valid_dateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected