Index: src/platform-posix.cc |
diff --git a/src/platform-posix.cc b/src/platform-posix.cc |
index 5ef92b14ac448232fb7dec6eca2fb5a378066393..1244493593b4db44aa67ab9def68b1e433a88d07 100644 |
--- a/src/platform-posix.cc |
+++ b/src/platform-posix.cc |
@@ -318,7 +318,19 @@ int OS::GetUserTime(uint32_t* secs, uint32_t* usecs) { |
double OS::TimeCurrentMillis() { |
- return Time::Now().ToJsTime(); |
+ struct timeval tv; |
+ if (gettimeofday(&tv, NULL) < 0) return 0.0; |
+ return (static_cast<double>(tv.tv_sec) * 1000) + |
+ (static_cast<double>(tv.tv_usec) / 1000); |
+} |
+ |
+ |
+int64_t OS::Ticks() { |
+ // gettimeofday has microsecond resolution. |
+ struct timeval tv; |
+ if (gettimeofday(&tv, NULL) < 0) |
+ return 0; |
+ return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec; |
} |