]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/TimeoutChecker.cpp
JavaScriptCore-903.tar.gz
[apple/javascriptcore.git] / runtime / TimeoutChecker.cpp
index 2a8acced8d12c8f1d15066a36f78c3a80a8bca35..81a096aad2826ca963ed2442930bd8b6970adaee 100644 (file)
@@ -98,7 +98,10 @@ static inline unsigned getCPUTime()
     return GETUPTIMEMS();
 #else
     // FIXME: We should return the time the current thread has spent executing.
     return GETUPTIMEMS();
 #else
     // FIXME: We should return the time the current thread has spent executing.
-    return currentTime() * 1000;
+
+    // use a relative time from first call in order to avoid an overflow
+    static double firstTime = currentTime();
+    return static_cast<unsigned> ((currentTime() - firstTime) * 1000);
 #endif
 }
 
 #endif
 }