summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrobert-hh <robert@hammelrath.com>2022-11-28 20:56:14 +0100
committerDamien George <damien@micropython.org>2022-12-14 13:04:09 +1100
commit913f9ad5ad9bb446c6e4310b6b5eda310098a1cf (patch)
treef74cc98b7e36522e5a0c81237332075dd10648d4
parent17ab2f671b1abe93ccd0024c6750a63e0c20ee6a (diff)
mimxrt/machine_rtc: Set the microsecond value to 0.
Set the subsecond value reported by rtc.datetime() and rtc.now() to 0. Synchronizing the roll-over with the second change was not precise.
-rw-r--r--ports/mimxrt/machine_rtc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/ports/mimxrt/machine_rtc.c b/ports/mimxrt/machine_rtc.c
index da7a43749..702c1b903 100644
--- a/ports/mimxrt/machine_rtc.c
+++ b/ports/mimxrt/machine_rtc.c
@@ -38,7 +38,6 @@ typedef struct _machine_rtc_obj_t {
// Singleton RTC object.
STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
-uint32_t us_offset = 0;
// Start the RTC Timer.
void machine_rtc_start(void) {
@@ -83,7 +82,7 @@ STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args)
mp_obj_new_int(srtc_date.hour),
mp_obj_new_int(srtc_date.minute),
mp_obj_new_int(srtc_date.second),
- mp_obj_new_int((ticks_us64() + us_offset) % 1000000),
+ mp_obj_new_int(0),
};
return mp_obj_new_tuple(8, tuple);
} else {
@@ -104,7 +103,6 @@ STATIC mp_obj_t machine_rtc_datetime_helper(size_t n_args, const mp_obj_t *args)
if (SNVS_LP_SRTC_SetDatetime(SNVS, &srtc_date) != kStatus_Success) {
mp_raise_ValueError(NULL);
}
- us_offset = (1000000 + mp_obj_get_int(items[7]) - ticks_us64() % 1000000) % 1000000;
return mp_const_none;
}
@@ -127,7 +125,7 @@ STATIC mp_obj_t machine_rtc_now(mp_obj_t self_in) {
mp_obj_new_int(srtc_date.hour),
mp_obj_new_int(srtc_date.minute),
mp_obj_new_int(srtc_date.second),
- mp_obj_new_int((ticks_us64() + us_offset) % 1000000),
+ mp_obj_new_int(0),
mp_const_none,
};
return mp_obj_new_tuple(8, tuple);