Ok, what I want to share here is not a question to a problem, but more like a wonder. After connecting VBAT using battery and reboot micropython in NUCLEO board, when I try :
>>> time.localtime()
(2017, 7, 14, 16, 6, 22, 4, 195)
>>> pyb.RTC().datetime()
(2017, 7, 14, 5, 16, 7, 27, 239)
it return current time and date. problem is, I've NEVER set it before. How can the time is auto synced with current time? what kind of sorcery is this?
Time and RTC auto sync?
-
- Posts: 81
- Joined: Fri Sep 02, 2016 9:26 am
Re: Time and RTC auto sync?
Ok after do a bit investigation, the RTC is synced to my PC date time after connecting through REPL. neat! but might be troublesome in case the REPL host current date and time is incorrect/tampered with. will look at how to disable this auto sync feature and use manual sync. any pointers?
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: Time and RTC auto sync?
How are you connecting? Dave Hylands' rshell does this, partly to ensure that file datetimes are correct for synchronisation.
To avoid this behaviour connect with a terminal application. Result: no sorcery
To avoid this behaviour connect with a terminal application. Result: no sorcery
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Time and RTC auto sync?
If you're using rshell, there currently isn't a command line option to disable the time sync. You can comment out this line:
https://github.com/dhylands/rshell/blob ... n.py#L1271
and that will cause rshell to no longer sync the time on the device.
https://github.com/dhylands/rshell/blob ... n.py#L1271
and that will cause rshell to no longer sync the time on the device.
-
- Posts: 81
- Joined: Fri Sep 02, 2016 9:26 am
Re: Time and RTC auto sync?
Yes, I am connect to the board using rshell..
thanks!
thanks!