about summary refs log tree commit diff homepage
path: root/lib/Support/Timer.cpp
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2017-06-07 13:36:28 +0200
committerMartinNowack <martin.nowack@gmail.com>2018-09-18 10:36:36 +0100
commitb2659ec04a9814718736ad960635a9a28edd6078 (patch)
tree5b7b383549644760782be0d23b827968decd4694 /lib/Support/Timer.cpp
parentbad4c5083b3e160abfaa84ede071c5e69d1f2709 (diff)
downloadklee-b2659ec04a9814718736ad960635a9a28edd6078.tar.gz
llvm4: use chrono helpers from LLVM
LLVM 4 removes the old time interface and starts using the C++11's
chrono. So switch to that in klee for LLVM 4 too.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r--lib/Support/Timer.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp
index da969810..0e727bb4 100644
--- a/lib/Support/Timer.cpp
+++ b/lib/Support/Timer.cpp
@@ -15,6 +15,20 @@
 using namespace klee;
 using namespace llvm;
 
+#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0)
+
+WallTimer::WallTimer() {
+  start = util::getWallTimeVal();
+}
+
+uint64_t WallTimer::check() {
+  auto now = util::getWallTimeVal();
+  return std::chrono::duration_cast<std::chrono::microseconds>(now -
+    start).count();
+}
+
+#else
+
 WallTimer::WallTimer() {
   startMicroseconds = util::getWallTimeVal().usec();
 }
@@ -22,3 +36,5 @@ WallTimer::WallTimer() {
 uint64_t WallTimer::check() {
   return util::getWallTimeVal().usec() - startMicroseconds;
 }
+
+#endif