From 82bce6c077b9b055c76f28d8e812f8796b80cf87 Mon Sep 17 00:00:00 2001 From: zhangyanjiao Date: Wed, 5 Mar 2025 17:38:06 +0800 Subject: [PATCH] fix(wifi): Add new api to get mac clock time Closes https://github.com/espressif/esp-idf/issues/15348 --- components/esp_wifi/include/esp_private/wifi.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/components/esp_wifi/include/esp_private/wifi.h b/components/esp_wifi/include/esp_private/wifi.h index d9f06401bd..5487286bfe 100644 --- a/components/esp_wifi/include/esp_private/wifi.h +++ b/components/esp_wifi/include/esp_private/wifi.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -777,6 +777,14 @@ esp_err_t esp_wifi_connect_internal(void); */ esp_err_t esp_wifi_disconnect_internal(void); +/** + * @brief Get the time information from the MAC clock. The time is precise only if modem sleep or light sleep is not enabled. + * + * @return 32-bit time value, unit: microsecond. This time is only 32 bits, which means it will overflow and reset to 0 after approximately 71 minutes. + * Therefore, when using it, the time difference between two consecutive readings should not be too long. + */ +uint32_t esp_wifi_internal_get_mac_clock_time(void); + #ifdef __cplusplus } #endif