setting system time/date
Posted: Tue Apr 26, 2022 8:52 pm
Hello,
I have an external RTC connected to the ESP32 via an i2c port. I want to use this time/date as the ESP32 time reference. I need to update the ESP32 time/date at boot with this external RTC value. I also have an sdcard interface and I want to be able to create a file and have that file time/date info match the RTC time/date. Currently I'm using POSIX commands such as fopen() and when a file or directory is created I get the default time/date which is something like 11:00pm, January 1, 1979. I know that I need to initialize the ESP32 time and date from the RTC at boot and have looked at the comments/examples on the web for this with no luck. Most of the info seems to be using an internet retreived time/date. My device only uses AP mode and I have no internet connection hence the need for the RTC.
Can any one provide an example of setting the time/date of the ESP32 based on the following strings(that I get from my i2c connected RTC chipset)
time: 14:48:22
date: 04/26/2022
I have the current time/date, just need to know how to initialize the ESP32 timer system with that value at boot so when a user creates a file on the sd card from a client connected device it will have the correct date.
Any help would be appreciated.
Thanks
I have an external RTC connected to the ESP32 via an i2c port. I want to use this time/date as the ESP32 time reference. I need to update the ESP32 time/date at boot with this external RTC value. I also have an sdcard interface and I want to be able to create a file and have that file time/date info match the RTC time/date. Currently I'm using POSIX commands such as fopen() and when a file or directory is created I get the default time/date which is something like 11:00pm, January 1, 1979. I know that I need to initialize the ESP32 time and date from the RTC at boot and have looked at the comments/examples on the web for this with no luck. Most of the info seems to be using an internet retreived time/date. My device only uses AP mode and I have no internet connection hence the need for the RTC.
Can any one provide an example of setting the time/date of the ESP32 based on the following strings(that I get from my i2c connected RTC chipset)
time: 14:48:22
date: 04/26/2022
I have the current time/date, just need to know how to initialize the ESP32 timer system with that value at boot so when a user creates a file on the sd card from a client connected device it will have the correct date.
Any help would be appreciated.
Thanks