aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/WallClockTimer.hpp
diff options
context:
space:
mode:
authorRob Hughes <robert.hughes@arm.com>2018-11-21 09:55:52 +0000
committerMatteo Martincigh <matteo.martincigh@arm.com>2018-11-26 13:02:31 +0000
commit0214d7e7d075ae2b8534847d4d5fd9c485626694 (patch)
tree8eb34b04c6281ebc12a5309dacd3f60caaee61df /src/armnn/WallClockTimer.hpp
parente02d60154d8230f555c832c1cce1865b54dc6589 (diff)
downloadarmnn-0214d7e7d075ae2b8534847d4d5fd9c485626694.tar.gz
Fix compile errors on Windows
Change-Id: I40acb42360bfcda09485efb2a54144d8e35bdafb
Diffstat (limited to 'src/armnn/WallClockTimer.hpp')
-rw-r--r--src/armnn/WallClockTimer.hpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/armnn/WallClockTimer.hpp b/src/armnn/WallClockTimer.hpp
index 88cbb4d50d..197ad7d1b7 100644
--- a/src/armnn/WallClockTimer.hpp
+++ b/src/armnn/WallClockTimer.hpp
@@ -11,7 +11,7 @@
namespace armnn
{
-// Clock class that uses the same timestamp function as the Mali DDK.
+// Clock class that uses the same timestamp function as the Mali DDK where possible.
class monotonic_clock_raw {
public:
using duration = std::chrono::nanoseconds;
@@ -19,9 +19,15 @@ public:
static std::chrono::time_point<monotonic_clock_raw, std::chrono::nanoseconds> now() noexcept
{
+#if defined(__unix__)
timespec ts;
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
- return time_point(std::chrono::nanoseconds(ts.tv_sec*1000000000 + ts.tv_nsec));
+ return time_point(std::chrono::nanoseconds(ts.tv_sec * 1000000000 + ts.tv_nsec));
+#else
+ // On other platforms we have to make do with the standard C++ API, which may not exactly match
+ // the Mali DDK.
+ return std::chrono::time_point<monotonic_clock_raw, std::chrono::nanoseconds>();
+#endif
}
};