| 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
|
|
|