Page 1 of 1
How to set rtc time
Posted: Fri Nov 17, 2017 6:17 am
by RenJian
Hi,
I can find "rtc_time_get" to get the current time, but How can I reset the rtc time? have any apis?
thanks very much!
Re: How to set rtc time
Posted: Sat Nov 18, 2017 1:34 pm
by ESP_Sprite
If I recall correctly, hardware doesn't support setting the RTC time. Suggest either using the 'standard' time APIs (which will automatically use a RTC delta instead of the absolute RTC time) or calculating the difference in actual RTC time and what you want it to be yourself and subtracting that from RTC time readings.
Re: How to set rtc time
Posted: Tue Nov 21, 2017 6:26 am
by RenJian
Hi,
Thanks for reply.
I find three rtc apis: get_time_since_boot/get_boot_time/set_boot_time.
if I want to set the rtc time, Can I just set boot time with "set_boot_time" api? and Getting the rtc time use "rtc_time = get_time_since_boot + get_boot_time"?
Re: How to set rtc time
Posted: Wed Nov 22, 2017 4:51 am
by ESP_igrr
I think these functions are internal/static. The suggested approach is to use gettimeofday/settimeofday functions.