What changed, and why it matters
This is a routine code cleanup that swaps one internal MicroPython time module for another. It does not fix or introduce any security issue visible in the commit.
No security action required. Treat as normal refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit replaces the legacy utime_mphal.c implementation with MicroPython’s newer generic modtime.c and enables MICROPY_TIME_SUPPORT_Y2100_AND_BEYOND. It also updates include paths from extmod/utime_mphal.h to extmod/modtime.h. The Trezor-specific modutime.c wrapper remains in place. No functional security changes are evident.
Changed components
core/SConscript.firmwarecore/SConscript.unixcore/embed/projects/firmware/mpconfigport.hcore/embed/projects/unix/mpconfigport.hcore/embed/upymod/build.rscore/embed/upymod/modutime.cInspect captured patch +6 / −6
diff --git a/core/SConscript.firmware b/core/SConscript.firmware
index f4927e5c..1db15073 100644
--- a/core/SConscript.firmware
+++ b/core/SConscript.firmware
@@ -324,8 +324,8 @@ SOURCE_MOD += [
]
SOURCE_MICROPYTHON = [
+ 'vendor/micropython/extmod/modtime.c',
'vendor/micropython/extmod/moductypes.c',
- 'vendor/micropython/extmod/utime_mphal.c',
'vendor/micropython/shared/libc/abort_.c',
'vendor/micropython/shared/libc/printf.c',
'vendor/micropython/shared/runtime/gchelper_m3.s',
diff --git a/core/SConscript.unix b/core/SConscript.unix
index 8800c8f4..79c88d7d 100644
--- a/core/SConscript.unix
+++ b/core/SConscript.unix
@@ -306,9 +306,9 @@ SOURCE_MOD += [
]
SOURCE_MICROPYTHON = [
+ 'vendor/micropython/extmod/modtime.c',
'vendor/micropython/extmod/moductypes.c',
'vendor/micropython/extmod/modos.c',
- 'vendor/micropython/extmod/utime_mphal.c',
'vendor/micropython/shared/readline/readline.c',
'vendor/micropython/shared/timeutils/timeutils.c',
'vendor/micropython/py/argcheck.c',
diff --git a/core/embed/projects/firmware/mpconfigport.h b/core/embed/projects/firmware/mpconfigport.h
index ad9be500..da362a1b 100644
--- a/core/embed/projects/firmware/mpconfigport.h
+++ b/core/embed/projects/firmware/mpconfigport.h
@@ -80,6 +80,7 @@
#define MICROPY_ENABLE_SOURCE_LINE (1)
#endif
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
+#define MICROPY_TIME_SUPPORT_Y2100_AND_BEYOND (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#define MICROPY_MODULE_WEAK_LINKS (0)
#define MICROPY_CAN_OVERRIDE_BUILTINS (0)
@@ -153,7 +154,6 @@
#define MICROPY_PY_RANDOM_EXTRA_FUNCS (0)
#define MICROPY_PY_SELECT (0)
#define MICROPY_PY_TIME (1)
-#define MICROPY_PY_UTIME_MP_HAL (1)
#define MICROPY_PY_OS_DUPTERM (0)
#define MICROPY_PY_LWIP_SOCK_RAW (0)
#define MICROPY_PY_MACHINE (0)
diff --git a/core/embed/projects/unix/mpconfigport.h b/core/embed/projects/unix/mpconfigport.h
index a4241d5e..29744c9b 100644
--- a/core/embed/projects/unix/mpconfigport.h
+++ b/core/embed/projects/unix/mpconfigport.h
@@ -88,6 +88,7 @@
#define MICROPY_ENABLE_SOURCE_LINE (1)
#endif
#define MICROPY_FLOAT_IMPL (MICROPY_FLOAT_IMPL_FLOAT)
+#define MICROPY_TIME_SUPPORT_Y2100_AND_BEYOND (1)
#define MICROPY_STREAMS_NON_BLOCK (1)
#define MICROPY_MODULE_WEAK_LINKS (0)
#define MICROPY_CAN_OVERRIDE_BUILTINS (0)
@@ -168,7 +169,6 @@
#define MICROPY_PY_RANDOM_EXTRA_FUNCS (0)
#define MICROPY_PY_SELECT (0)
#define MICROPY_PY_TIME (1)
-#define MICROPY_PY_UTIME_MP_HAL (1)
#define MICROPY_PY_OS_DUPTERM (0)
#define MICROPY_PY_LWIP_SOCK_RAW (0)
#define MICROPY_PY_MACHINE (0)
diff --git a/core/embed/upymod/build.rs b/core/embed/upymod/build.rs
index fd1b466f..077958b8 100644
--- a/core/embed/upymod/build.rs
+++ b/core/embed/upymod/build.rs
@@ -130,7 +130,7 @@ fn main() -> Result<()> {
lib.add_sources_in_dir(
mpy_dir,
[
- "extmod/utime_mphal.c",
+ "extmod/modtime.c",
"shared/timeutils/timeutils.c",
"py/argcheck.c",
"py/asmarm.c",
diff --git a/core/embed/upymod/modutime.c b/core/embed/upymod/modutime.c
index 83fc5246..a101004b 100644
--- a/core/embed/upymod/modutime.c
+++ b/core/embed/upymod/modutime.c
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#include "extmod/utime_mphal.h"
+#include "extmod/modtime.h"
#include "shared/timeutils/timeutils.h"
// copy of ports/stm32/modutime.c:time_localtime, without support
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.