aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/util.h b/util.h
index 1c7215d29d..5d18776002 100644
--- a/util.h
+++ b/util.h
@@ -321,11 +321,19 @@ inline void PrintHex(vector<unsigned char> vch, const char* pszFormat="%s", bool
{
printf(pszFormat, HexStr(vch, fSpaces).c_str());
}
+
inline int64 PerformanceCounter()
{
- int64 nCounter = 0;
- QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
+ int64 nCounter = 0;
+#ifdef __WXMSW__
+ QueryPerformanceCounter((LARGE_INTEGER*)&nCounter);
+#else
+ // this could be changed to reading /dev/urandom
+ timeval t;
+ gettimeofday(&t, NULL);
+ nCounter += t.tv_sec * 1000000 + t.tv_usec;
+#endif
return nCounter;
}