static inline void clock_basetime(FAR struct timespec *tp) { time_t jdn = 0; /* Get the EPOCH-relative julian date from the calendar year, * month, and date */ jdn = clock_calendar2utc(CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY); /* Set the base time as seconds into this julian day. */ tp->tv_sec = jdn * SEC_PER_DAY; tp->tv_nsec = 0; }
time_t mktime(FAR struct tm *tp) { time_t ret; time_t jdn; /* Get the EPOCH-relative julian date from the calendar year, * month, and date */ jdn = clock_calendar2utc(tp->tm_year + 1900, tp->tm_mon, tp->tm_mday); sdbg("jdn=%d tm_year=%d tm_mon=%d tm_mday=%d\n", (int)jdn, tp->tm_year, tp->tm_mon, tp->tm_mday); /* Return the seconds into the julian day. */ ret = ((jdn * 24 + tp->tm_hour) * 60 + tp->tm_min) * 60 + tp->tm_sec; sdbg("ret=%d tm_hour=%d tm_min=%d tm_sec=%d\n", (int)ret, tp->tm_hour, tp->tm_min, tp->tm_sec); return ret; }