mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'bugfix/clock_getres_accuracy_resolution' into 'master'
newlib: Fix clock_getres() improves accuracy See merge request espressif/esp-idf!10743
This commit is contained in:
commit
4df4bd9558
@ -72,7 +72,7 @@ int64_t esp_system_get_time(void);
|
||||
/**
|
||||
* @brief Get the resolution of the time returned by `esp_system_get_time`.
|
||||
*
|
||||
* @returns the resolution in microseconds
|
||||
* @returns the resolution in nanoseconds
|
||||
*/
|
||||
uint32_t esp_system_get_time_resolution(void);
|
||||
|
||||
|
@ -42,5 +42,5 @@ int64_t IRAM_ATTR __attribute__((weak)) esp_system_get_time(void)
|
||||
|
||||
uint32_t IRAM_ATTR __attribute__((weak)) esp_system_get_time_resolution(void)
|
||||
{
|
||||
return 1000000L / rtc_clk_slow_freq_get_hz();
|
||||
return 1000000000L / rtc_clk_slow_freq_get_hz();
|
||||
}
|
@ -534,6 +534,6 @@ int64_t IRAM_ATTR esp_system_get_time(void)
|
||||
|
||||
uint32_t IRAM_ATTR esp_system_get_time_resolution(void)
|
||||
{
|
||||
return 1;
|
||||
return 1000;
|
||||
}
|
||||
#endif
|
@ -287,7 +287,7 @@ int clock_getres (clockid_t clock_id, struct timespec *res)
|
||||
}
|
||||
|
||||
res->tv_sec = 0;
|
||||
res->tv_nsec = esp_system_get_time_resolution() * 1000;
|
||||
res->tv_nsec = esp_system_get_time_resolution();
|
||||
|
||||
return 0;
|
||||
#else
|
||||
|
Loading…
x
Reference in New Issue
Block a user