Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(46)

Unified Diff: webrtc/base/timeutils.cc

Issue 2290203002: Delete Timing class, timing.h, and update all users. (Closed)
Patch Set: Fix copy-paste error in rtpdataengine.cc. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/base/timeutils.h ('k') | webrtc/base/timing.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/timeutils.cc
diff --git a/webrtc/base/timeutils.cc b/webrtc/base/timeutils.cc
index 1be368eb5847a95cca75833ee0e4d0e57644afcd..658d0796adad16dd1663621a14aa65362c7962ea 100644
--- a/webrtc/base/timeutils.cc
+++ b/webrtc/base/timeutils.cc
@@ -23,6 +23,7 @@
#endif
#include <windows.h>
#include <mmsystem.h>
+#include <sys/timeb.h>
#endif
#include "webrtc/base/checks.h"
@@ -185,4 +186,21 @@ int64_t TmToSeconds(const std::tm& tm) {
(year - 1970) * 365 + day) * 24 + hour) * 60 + min) * 60 + sec;
}
+int64_t TimeUTCMicros() {
+#if defined(WEBRTC_POSIX)
+ struct timeval time;
+ gettimeofday(&time, NULL);
+ // Convert from second (1.0) and microsecond (1e-6).
+ return (static_cast<int64_t>(time.tv_sec) * rtc::kNumMicrosecsPerSec +
+ time.tv_usec);
+
+#elif defined(WEBRTC_WIN)
+ struct _timeb time;
+ _ftime(&time);
+ // Convert from second (1.0) and milliseconds (1e-3).
+ return (static_cast<int64_t>(time.time) * rtc::kNumMicrosecsPerSec +
+ static_cast<int64_t>(time.millitm) * rtc::kNumMicrosecsPerMillisec);
+#endif
+}
+
} // namespace rtc
« no previous file with comments | « webrtc/base/timeutils.h ('k') | webrtc/base/timing.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698