Closed rhermanklink closed 2 months ago
This module was designed for MicroPython which normally runs on "bare metal" microcontrollers with no underlying OS, and in many cases no network connectivity. Consequently time support is limited to the time reported by the hardware RTC. Consequently the MicroPython time library does not support some of the methods you are using.
I can see that what you have done is useful to CPython users, and you may want to promote and maintain your own fork, but I can't accept this for MicroPython users. Sorry.
This Pull Request changes the sched module from using the machine time-dependent functions
localtime()
,timemk()
to thegmtime()
,timegm()
functions respectively, which use UTC. Fortimegm()
a minimal implementation was added to thecron.py
file. This would prevent items from being scheduled in a DST transition, as UTC does not do DST. This change makes the callers ofschedule
andcron
need to usegmtime()
andtimegm()
too, which the tests have been modified to do.Along with this, a few minor changes were made to make the module also work on CPython, such as changing
const(n)
ton
.