Hello!
I'm in the development phase of a project so I print the date time each time I reboot my device with the print command (time.localtime ()). And sometimes comes the result (2000, 1, 1, 0, 0, 4, 5, 1) which is the starting time date. But sometimes I get the correct correct date time. However I did not do anything to set this system time. Where does my ESP32 get this time? Is it safe to use it?
date time system
date time system
Eng. Luiz Nebenzahl
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: date time system
What IDE or development environment are you using? Perhaps that is setting the time. Note that the RTC will continue to run through a reboot.
The simple way to set the time is to acquire internet connectivity and run ntptime which gets time from an NTP server:
The simple way to set the time is to acquire internet connectivity and run ntptime which gets time from an NTP server:
Code: Select all
import ntptime
ntptime.settime()
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: date time system
Yes, I understand that.
I use vscode.
I was curious because I do not use any way to update the time, however, suddenly the time is correct.
I can not imagine what makes the time right.
In this project I use the time directly from the satellite. and in the device the time is not important.
I use vscode.
I was curious because I do not use any way to update the time, however, suddenly the time is correct.
I can not imagine what makes the time right.
In this project I use the time directly from the satellite. and in the device the time is not important.
Eng. Luiz Nebenzahl
Re: date time system
If you happen to be using rshell, it sets the time of the board to match the time of the PC.
Re: date time system
Yes, that's it, I use rshell.
Great deduction.
Thanks for listening.
Really Thank you so much!
Great deduction.
Thanks for listening.
Really Thank you so much!
Eng. Luiz Nebenzahl