Time keeping in light sleep

ggoblin
Posts: 0
Joined: Mon Apr 16, 2018 7:32 pm

Time keeping in light sleep

Postby ggoblin » Mon Apr 16, 2018 8:30 pm

Hi,
I need to keep track of time during light sleep. Since the CPU is off I assume none of the timers will work. Is there another way to keep track of time during light sleep? Can RTC be used somehow?

Thanks

ESP_igrr
Posts: 950
Joined: Tue Dec 01, 2015 8:37 am

Re: Time keeping in light sleep

Postby ESP_igrr » Tue Apr 17, 2018 12:54 am

In light sleep, timekeeping is done by RTC timer. On exiting sleep, system time (as reported by 'gettimeofday') will be updated based to the RTC timer.

There's another change which will be merged soon, which also adjusts time reported by esp_timer_get_time.

If you want to implement your own timekeeping mechanism, you can get RTC time from esp_clk_rtc_time function in esp_clk.h.

Who is online

Users browsing this forum: No registered users and 1 guest