Merge branch 'bugfix/printf-placeholder-for-time_t' into 'master'

components: correct printf() placeholder for time_t

See merge request espressif/esp-idf!17439
This commit is contained in:
Anton Maklakov 2022-03-17 16:08:08 +08:00
commit 6200d2328d
6 changed files with 9 additions and 9 deletions

View File

@ -70,7 +70,7 @@ static void test_leak_setup(const char *file, long line)
struct timeval te;
gettimeofday(&te, NULL); // get current time
esp_read_mac(mac, ESP_MAC_WIFI_STA);
printf("%s:%ld: time=%ld.%lds, mac:" MACSTR "\n", file, line, te.tv_sec, te.tv_usec, MAC2STR(mac));
printf("%s:%ld: time=%jd.%lds, mac:" MACSTR "\n", file, line, (intmax_t)te.tv_sec, te.tv_usec, MAC2STR(mac));
// Execute esp_sha operation to allocate internal SHA semaphore memory
// which is considered as leaked otherwise
const uint8_t input_buffer[64];

View File

@ -30,7 +30,7 @@ static void test_leak_setup(const char * file, long line)
struct timeval te;
gettimeofday(&te, NULL); // get current time
esp_read_mac(mac, ESP_MAC_WIFI_STA);
printf("%s:%ld: time=%ld.%lds, mac:" MACSTR "\n", file, line, te.tv_sec, te.tv_usec, MAC2STR(mac));
printf("%s:%ld: time=%jd.%lds, mac:" MACSTR "\n", file, line, (intmax_t)te.tv_sec, te.tv_usec, MAC2STR(mac));
test_utils_record_free_mem();
}

View File

@ -621,7 +621,7 @@ static void check_time(void)
int latency_before_run_ut = 1 + (esp_rtc_get_time_us() - s_time_in_reboot) / 1000000;
struct timeval tv;
gettimeofday(&tv, NULL);
printf("timestamp %ld (s)\n", tv.tv_sec);
printf("timestamp %jd (s)\n", (intmax_t)tv.tv_sec);
int dt = tv.tv_sec - s_saved_time;
printf("delta timestamp = %d (s)\n", dt);
TEST_ASSERT_GREATER_OR_EQUAL(0, dt);

View File

@ -77,7 +77,7 @@ TEST_CASE("ULP-RISC-V and main CPU are able to exchange data", "[ulp]")
while (ulp_command_resp != RISCV_READ_WRITE_TEST)
;
gettimeofday(&end, NULL);
printf("Response time %ld ms\n", (end.tv_sec - start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
printf("Response time %jd ms\n", ((intmax_t)end.tv_sec - (intmax_t)start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
/* Verify test data */
TEST_ASSERT(ulp_command_resp == RISCV_READ_WRITE_TEST);
@ -113,7 +113,7 @@ TEST_CASE("ULP-RISC-V is able to wakeup main CPU from light sleep", "[ulp]")
while (ulp_command_resp != RISCV_LIGHT_SLEEP_WAKEUP_TEST)
;
gettimeofday(&end, NULL);
printf("Response time %ld ms\n", (end.tv_sec - start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
printf("Response time %jd ms\n", ((intmax_t)end.tv_sec - (intmax_t)start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
/* Verify test data */
TEST_ASSERT(ulp_command_resp == RISCV_LIGHT_SLEEP_WAKEUP_TEST);

View File

@ -357,8 +357,8 @@ compare_scan_neighbor_results(struct wpa_supplicant *wpa_s, os_time_t age_secs,
os_time_expired(&now, &target->last_update,
age_secs)) {
wpa_printf(MSG_DEBUG,
"Candidate BSS is more than %ld seconds old",
age_secs);
"Candidate BSS is more than %jd seconds old",
(intmax_t)age_secs);
continue;
}
}

View File

@ -107,8 +107,8 @@ void app_main(void)
struct timeval outdelta;
while (sntp_get_sync_status() == SNTP_SYNC_STATUS_IN_PROGRESS) {
adjtime(NULL, &outdelta);
ESP_LOGI(TAG, "Waiting for adjusting time ... outdelta = %li sec: %li ms: %li us",
(long)outdelta.tv_sec,
ESP_LOGI(TAG, "Waiting for adjusting time ... outdelta = %jd sec: %li ms: %li us",
(intmax_t)outdelta.tv_sec,
outdelta.tv_usec/1000,
outdelta.tv_usec%1000);
vTaskDelay(2000 / portTICK_PERIOD_MS);