#include typedef struct { uint16_t year; uint8_t week_day; uint8_t month; uint8_t month_day; uint8_t hours; uint8_t minutes; uint8_t seconds; uint8_t ticks; } rtc_time_t; void rtc_get_time(rtc_time_t *time); time_t time(time_t *timeptr) { rtc_time_t rtc; struct tm tm; time_t calendar; rtc_get_time(&rtc); tm.tm_sec = rtc.seconds; tm.tm_min = rtc.minutes; tm.tm_hour = rtc.hours; tm.tm_mday = rtc.month_day; tm.tm_mon = rtc.month; tm.tm_year = rtc.year - 1900; tm.tm_isdst = 0; calendar = mktime(&tm); if(timeptr != NULL) *timeptr = calendar; return calendar; }