summaryrefslogtreecommitdiff
path: root/shared/timeutils/timeutils.h
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-03-14 20:38:46 +0100
committerDamien George <damien@micropython.org>2022-04-11 12:25:23 +1000
commitb70b8ce3e4f213e297b4438dbfca7412525a3785 (patch)
tree42690990d707314315357bb1b8ba28bc44bafa46 /shared/timeutils/timeutils.h
parente3030f74361c5e930107aaf973963447ad36575a (diff)
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.
Diffstat (limited to 'shared/timeutils/timeutils.h')
-rw-r--r--shared/timeutils/timeutils.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/shared/timeutils/timeutils.h b/shared/timeutils/timeutils.h
index 66e2a77f1..9f4b500ca 100644
--- a/shared/timeutils/timeutils.h
+++ b/shared/timeutils/timeutils.h
@@ -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;
}