mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 01:27:11 +08:00
feat(newlib): Add macro ESP8266_TIME_SYSCALL_USE_FRC1 to enable clock_gettime function
This commit is contained in:
@ -321,6 +321,24 @@ config ESP_ERR_TO_NAME_LOOKUP
|
||||
order to save memory but this comes at the price of sacrificing
|
||||
distinguishable (meaningful) output string representations.
|
||||
|
||||
choice ESP8266_TIME_SYSCALL
|
||||
prompt "Timers used for gettimeofday function"
|
||||
default ESP8266_TIME_SYSCALL_USE_FRC1
|
||||
help
|
||||
This setting defines which hardware timers are used to
|
||||
implement 'gettimeofday' and 'time' functions in C library.
|
||||
|
||||
- If high-resolution timer is used, gettimeofday will
|
||||
provide time at microsecond resolution.
|
||||
Time will not be preserved when going into deep sleep mode.
|
||||
- If no timers are used, gettimeofday and time functions
|
||||
return -1 and set errno to ENOSYS.
|
||||
|
||||
config ESP8266_TIME_SYSCALL_USE_FRC1
|
||||
bool "High-resolution timer"
|
||||
config ESP8266_TIME_SYSCALL_USE_NONE
|
||||
bool "None"
|
||||
endchoice
|
||||
endmenu
|
||||
|
||||
menu Wi-Fi
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <reent.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/errno.h>
|
||||
@ -26,6 +27,12 @@
|
||||
#include "task.h"
|
||||
#include "driver/soc.h"
|
||||
|
||||
#include "sdkconfig.h"
|
||||
|
||||
#ifdef CONFIG_ESP8266_TIME_SYSCALL_USE_FRC1
|
||||
#define WITH_FRC 1
|
||||
#endif
|
||||
|
||||
static uint64_t s_boot_time;
|
||||
|
||||
static inline void set_boot_time(uint64_t time_us)
|
||||
|
Reference in New Issue
Block a user