esp-idf/components/newlib
Ivan Grokhotkov 8ccb2a4990 esp32: make time monotonic across resets
Small changes to clock calibration value will cause increasing errors
the longer the device runs. Consider the case of deep sleep, assuming
that RTC counter is used for timekeeping:
- before sleep:
   time_before = rtc_counter * calibration_val
- after sleep:
   time_after = (rtc_counter + sleep_count) * (calibration_val + epsilon)
where 'epsilon' is a small estimation error of 'calibration_val'.
The apparent sleep duration thus will be:
time_after - time_before = sleep_count * (calibration_val + epsilon)
                           + rtc_counter * epsilon

Second term on the right hand side is the error in time difference
estimation, it is proportional to the total system runtime (rtc_counter).

To avoid this issue, this change makes RTC_SLOW_CLK calibration value
persistent across restarts. This allows the calibration value update to
be preformed, while keeping time after update same as before the update.
2017-06-16 12:06:04 +08:00
..
include newlib: define PATH_MAX and ARG_MAX consistently 2017-05-05 15:21:38 +08:00
lib newlib: build with wcsftime function 2017-01-11 15:03:12 +08:00
platform_include newlib: implement time syscalls 2016-11-02 17:31:35 +08:00
test esp32: add [ignore] tag to some unit test cases for CI 2017-01-18 17:08:20 +08:00
.gitignore Initial public version 2016-08-17 23:08:22 +08:00
.gitmodules Initial public version 2016-08-17 23:08:22 +08:00
component.mk build system: Project ELF should depend on linker scripts, binary libraries 2016-12-12 15:58:53 +11:00
COPYING.NEWLIB Initial public version 2016-08-17 23:08:22 +08:00
libc_discard.list Initial public version 2016-08-17 23:08:22 +08:00
locks.c Add xPortInIsrContext function + unit test. This function returns true when the current CPU runs in an interrupt handler context. 2017-03-02 17:00:32 +08:00
Makefile.old Initial public version 2016-08-17 23:08:22 +08:00
reent_init.c vfs: code review fixes 2016-10-27 17:21:17 +08:00
syscall_table.c newlib: add "full" formatting support, add missing functions 2016-12-08 11:04:54 +08:00
syscalls.c panic handlers: Print the PC address where abort() was called, don't dump registers 2016-12-28 10:09:40 +11:00
time.c esp32: make time monotonic across resets 2017-06-16 12:06:04 +08:00