wlan: modify the timestamp format for the logs
Modified the timestamp format for the logs from
[Secondselapsedinaday.microseconds] to [hour:min:sec.msec].
This will help in correlating the logcat logs and
the Logging infra logs.
Change-Id: Ie58d78b9987e1e09fedef5ba042768000fdc4363
CRs-Fixed: 771157
diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
index e855360..fd70456 100644
--- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c
+++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
@@ -30,6 +30,7 @@
*
******************************************************************************/
#ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
+#include <linux/rtc.h>
#include <vmalloc.h>
#include <wlan_nlink_srv.h>
#include <vos_status.h>
@@ -50,7 +51,6 @@
#define INVALID_PID -1
#define MAX_LOGMSG_LENGTH 4096
-#define SECONDS_IN_A_DAY (86400)
struct log_msg {
struct list_head node;
@@ -297,6 +297,8 @@
unsigned long flags;
struct timeval tv;
+ struct rtc_time tm;
+ unsigned long local_time;
if (gapp_pid == INVALID_PID) {
/*
@@ -310,10 +312,14 @@
pr_err("%s\n", to_be_sent);
}
- /* Format the Log time [Secondselapsedinaday.microseconds] */
+ /* Format the Log time [hr:min:sec.microsec] */
do_gettimeofday(&tv);
- tlen = snprintf(tbuf, sizeof(tbuf), "[%s][%5lu.%06lu] ", current->comm,
- (unsigned long) (tv.tv_sec%SECONDS_IN_A_DAY),
+
+ /* Convert rtc to local time */
+ local_time = (u32)(tv.tv_sec - (sys_tz.tz_minuteswest * 60));
+ rtc_time_to_tm(local_time, &tm);
+ tlen = snprintf(tbuf, sizeof(tbuf), "[%s] [%02d:%02d:%02d.%06lu] ",
+ current->comm, tm.tm_hour, tm.tm_min, tm.tm_sec,
tv.tv_usec);
/* 1+1 indicate '\n'+'\0' */