mirror of
https://github.com/micropython/micropython.git
synced 2026-01-05 03:30:14 +01:00
mimxrt/machine_rtc: Start RTC at boot and set datetime if not set.
Changes in this commit: - Start the RTC Timer at system boot. Otherwise time.time() will advance only if an RTC() object was created. - Set the time to a more recent date than Jan 1, 1970, if not set. That is 2013/10/14, 19:53:11, MicroPython's first commit. - Compensate an underflow in in timeutils_seconds_since_2000(), called by time.time(), if the time is set to a pre-2000 date.
This commit is contained in:
@@ -69,6 +69,7 @@ static inline uint64_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t
|
||||
|
||||
static inline uint64_t timeutils_seconds_since_epoch(mp_uint_t year, mp_uint_t month,
|
||||
mp_uint_t date, mp_uint_t hour, mp_uint_t minute, mp_uint_t second) {
|
||||
// TODO this will give incorrect results for dates before 2000/1/1
|
||||
return timeutils_seconds_since_2000(year, month, date, hour, minute, second) + TIMEUTILS_SECONDS_1970_TO_2000;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user