From 2eb91c0040b1218aa493e68e4f325486d6fd3868 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 26 Sep 2013 10:22:01 +0900 Subject: [PATCH] Use the ecore_time_get instead of gettimeofday Change-Id: Ib6549170e79f36caabeffb201b12cf7f39637397 --- CMakeLists.txt | 1 + include/util.h | 2 +- src/util.c | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e821919..1797e86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,7 @@ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -g") ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") ADD_DEFINITIONS("-DLOG_TAG=\"LIVEBOX\"") ADD_DEFINITIONS("-DNDEBUG") +ADD_DEFINITIONS("-D_USE_ECORE_TIME_GET") ADD_DEFINITIONS("-DMASTER_PKGNAME=\"data-provider-master\"") ADD_DEFINITIONS("-DSLAVE_PKGNAME=\"com.samsung.data-provider-slave\"") diff --git a/include/util.h b/include/util.h index ad03f26..905974d 100644 --- a/include/util.h +++ b/include/util.h @@ -15,6 +15,6 @@ */ extern int util_check_extension(const char *filename, const char *check_ptr); -extern double util_get_timestamp(void); +extern double util_timestamp(void); /* End of a file */ diff --git a/src/util.c b/src/util.c index fd67d74..208ee6c 100644 --- a/src/util.c +++ b/src/util.c @@ -19,6 +19,7 @@ #include #include +#include #include #include "debug.h" @@ -41,13 +42,17 @@ int util_check_extension(const char *filename, const char *check_ptr) return 0; } -double util_get_timestamp(void) +double util_timestamp(void) { +#if defined(_USE_ECORE_TIME_GET) + return ecore_time_get(); +#else struct timeval tv; gettimeofday(&tv, NULL); return (double)tv.tv_sec + (double)tv.tv_usec / 1000000.0f; +#endif } /* End of a file */ -- 2.7.4