summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiraj Kumar Goit <niraj.g@samsung.com>2016-06-07 20:36:40 +0530
committerNiraj Kumar Goit <niraj.g@samsung.com>2016-06-07 20:36:40 +0530
commit5b43a352de45aef79f48bd9baa555e6ec194fe78 (patch)
tree202d218c71144e211dea5c0aa0748b09f82c841a
parent3fd4d4162e7966551a39fe5db60261f7c19a39d0 (diff)
downloadconnman-5b43a352de45aef79f48bd9baa555e6ec194fe78.tar.gz
connman-5b43a352de45aef79f48bd9baa555e6ec194fe78.tar.bz2
connman-5b43a352de45aef79f48bd9baa555e6ec194fe78.zip
log: Set log time with millisecond.
Change-Id: I6fe843025c41fc1d686bcfb79a62f64aecd7e0c1 Signed-off-by: Niraj Kumar Goit <niraj.g@samsung.com>
-rwxr-xr-xsrc/log.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/log.c b/src/log.c
index ead9b2e8..ef0fe4fd 100755
--- a/src/log.c
+++ b/src/log.c
@@ -40,6 +40,7 @@ static const char *program_path;
#if defined TIZEN_EXT
#include <sys/stat.h>
+#include <sys/time.h>
#define LOG_FILE_PATH "/opt/usr/data/network/connman.log"
#define MAX_LOG_SIZE 1 * 1024 * 1024
@@ -106,14 +107,15 @@ static void __connman_log_make_backup(void)
static void __connman_log_get_local_time(char *strtime, const int size)
{
- time_t buf;
+ struct timeval tv;
struct tm *local_ptm;
+ char buf[32];
- time(&buf);
- buf = time(NULL);
- local_ptm = localtime(&buf);
+ gettimeofday(&tv, NULL);
+ local_ptm = localtime(&tv.tv_sec);
- strftime(strtime, size, "%m/%d %H:%M:%S", local_ptm);
+ strftime(buf, sizeof(buf), "%m/%d %H:%M:%S", local_ptm);
+ snprintf(strtime, size, "%s.%03ld", buf, tv.tv_usec / 1000);
}
void __connman_log(const int log_priority, const char *format, va_list ap)