From 5679fe6aee7811447ab9dfc9b4539526b23b1d84 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 3 Feb 2022 00:12:08 +1100 Subject: [PATCH] rp2/modutime: Fix time.localtime day-of-week value. The correct day-of-week is stored in the RTC (0=Monday, 6=Sunday) so there is no need to adjust it for the return value of time.localtime(). Fixes issue #7889. Signed-off-by: Damien George --- ports/rp2/modutime.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/rp2/modutime.c b/ports/rp2/modutime.c index 8041ae65b6..a586073101 100644 --- a/ports/rp2/modutime.c +++ b/ports/rp2/modutime.c @@ -45,7 +45,7 @@ STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) { mp_obj_new_int(t.hour), mp_obj_new_int(t.min), mp_obj_new_int(t.sec), - mp_obj_new_int((t.dotw + 6) % 7), // convert 0=Sunday to 6=Sunday + mp_obj_new_int(t.dotw), mp_obj_new_int(timeutils_year_day(t.year, t.month, t.day)), }; return mp_obj_new_tuple(8, tuple);