ref: 33fe2b5883ce776e7c4fec88a049531d7785e491
parent: cbe650a3e574e698d48fcdd57d2fe272e5baa166
parent: 30bcfea6b89cdde67980e3821f0d087196a4fe6e
author: volvet <qizh@cisco.com>
date: Sun Jan 26 19:14:44 EST 2014
Merge pull request #225 from mstorsjo/simplify-ifdefs Simplify ifdefs in measure_time.h
--- a/codec/decoder/core/inc/measure_time.h
+++ b/codec/decoder/core/inc/measure_time.h
@@ -42,17 +42,14 @@
#include <stdlib.h>
-#if !(defined(_MSC_VER) || defined(__MINGW32__))
+#ifndef _WIN32
#include <sys/time.h>
#else
#include "typedefs.h"
-//#include <sys/types.h>
+#include <windows.h>
#include <sys/timeb.h>
#endif
#include <time.h>
-#if defined(_WIN32)
-#include <windows.h>
-#endif//#if _WIN32
#ifdef __cplusplus
extern "C" {
@@ -65,13 +62,12 @@
*/
int64_t WelsTime (void_t) {
-#if !(defined(_MSC_VER) || defined(__MINGW32__))
+#ifndef _WIN32
struct timeval tv_date;
gettimeofday (&tv_date, NULL);
return ((int64_t) tv_date.tv_sec * 1000000 + (int64_t) tv_date.tv_usec);
#else
-#if defined (_WIN32)
static int64_t iMtimeFreq = 0;
int64_t iMtimeCur = 0;
int64_t iResult = 0;
@@ -83,13 +79,7 @@
QueryPerformanceCounter ((LARGE_INTEGER*)&iMtimeCur);
iResult = (int64_t) ((double)iMtimeCur * 1e6 / (double)iMtimeFreq + 0.5);
return iResult;
-#else
- struct _timeb sTime;
-
- _ftime (&sTime);
- return ((int64_t)sTime.time * (1000) + (int64_t)sTime.millitm) * (1000);
-#endif//#if _WIN32
-#endif//!(defined(_MSC_VER) || defined(__MINGW32__))
+#endif//WIN32
}
#ifdef __cplusplus
--- a/codec/encoder/core/inc/measure_time.h
+++ b/codec/encoder/core/inc/measure_time.h
@@ -42,18 +42,14 @@
#include <stdlib.h>
-#if !(defined(_MSC_VER) || defined(__MINGW32__))
+#ifndef _WIN32
#include <sys/time.h>
#else
#include "typedefs.h"
-//#include <sys/types.h>
+#include <windows.h>
#include <sys/timeb.h>
#endif
#include <time.h>
-#if defined(_WIN32)
-#include <windows.h>
-//#include <mmsystem.h> // need static lib winmm.lib for link for such windows 95/98 mm timer
-#endif//#if _WIN32
/*!
* \brief time cost measure utilization
@@ -62,13 +58,12 @@
*/
static inline int64_t WelsTime() {
-#if !(defined(_MSC_VER) || defined(__MINGW32__))
+#ifndef _WIN32
struct timeval tv_date;
gettimeofday (&tv_date, NULL);
return ((int64_t) tv_date.tv_sec * 1000000 + (int64_t) tv_date.tv_usec);
#else
-#if defined (_WIN32)
static int64_t iMeasureTimeFreq = 0;
// static BOOL_T support_high_resolution_perf_flag = TRUE;
int64_t iMeasureTimeCur = 0;
@@ -94,13 +89,7 @@
// }
return iResult;
-#else
-struct _timeb tb;
-
-_ftime (&tb);
-return ((int64_t)tb.time * (1000) + (int64_t)tb.millitm) * (1000);
#endif//#if _WIN32
-#endif//!(defined(_MSC_VER) || defined(__MINGW32__))
}
#endif//WELS_TIME_COST_MEASURE_UTIL_H__