Closed saltydog101 closed 7 years ago
I wanted to make sure I'm not duplicating the same functionality elsewhere. Is someone already working on something similar?
Not to my knowledge, so feel free to go for it.
Some work on machine.RTC here: https://github.com/micropython/micropython-esp32/pull/85
Thanks mcauser! I'll just add the localtime method to utime to complete setting the time.
Cool, I should add a call to machine.RTC().init()
to mpy-utils as well ...
Actually, I did implement datetime()
in https://github.com/micropython/micropython-esp32/pull/85
Though, I need to update it to make a bit more sense, since I screwed up the year / month thing (1900 and 0-11) Edit 1: Fixed, pushed, matches implementation from the documentation.
Edit 2: Also, implemented using subseconds (255-0) instead of µseconds ... probably not the right thing to do for machine.RTC (as opposed to pyb.RTC)
Edit 3: Implemented RTC().init((
Has anybody wired in the SNTP code form the SDK? Seems like it'd be a nice fit.
Thanks @MrSurly, that's what I needed to set the time from ntp.
I've worked with the ESP8266, and there I would set the time on bootup via ntp. I was able to call the RTC class from machine and also, use utime.localtime to help calculate the delta. Then I would call RTC().datetime to set the time accordingly. In the ESP32 port, there is neither an RTC class or a localtime function from utime, I'd be glad to look at adding it, but I wanted to make sure I'm not duplicating the same functionality elsewhere. Is someone already working on something similar?