From 11455172b6299d501642c90f6709e53c59e10afe Mon Sep 17 00:00:00 2001 From: Wen Gong Date: Wed, 8 Mar 2023 19:14:52 -0800 Subject: [PATCH 9/9] wpa_debug: add print local time Signed-off-by: Wen Gong Signed-off-by: Amutha Ravikumar --- src/utils/wpa_debug.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c index 65d5af0..c32e0dd 100644 --- a/src/utils/wpa_debug.c +++ b/src/utils/wpa_debug.c @@ -9,6 +9,7 @@ #include "includes.h" #include "common.h" +#include #ifdef CONFIG_DEBUG_SYSLOG #include @@ -70,18 +71,28 @@ void wpa_debug_print_timestamp(void) { #ifndef CONFIG_ANDROID_LOG struct os_time tv; + time_t result = time(NULL); + char* dt; if (!wpa_debug_timestamp) return; os_get_time(&tv); + dt = ctime(&result); + dt[strlen(dt)-1]=0; + #ifdef CONFIG_DEBUG_FILE - if (out_file) - fprintf(out_file, "%ld.%06u: ", (long) tv.sec, + if (out_file) { + //fprintf(out_file, "%s", ctime(&timep)); + fprintf(out_file, "%s %ld.%06u: ", dt, (long) tv.sec, (unsigned int) tv.usec); + } #endif /* CONFIG_DEBUG_FILE */ - if (!out_file && !wpa_debug_syslog) - printf("%ld.%06u: ", (long) tv.sec, (unsigned int) tv.usec); + if (!out_file && !wpa_debug_syslog) { + //printf("%s", ctime(&timep)); + printf("%s %ld.%06u: ", dt, (long) tv.sec, (unsigned int) tv.usec); + } + #endif /* CONFIG_ANDROID_LOG */ }