Chromium Code Reviews| Index: webrtc/api/statscollector.cc |
| diff --git a/webrtc/api/statscollector.cc b/webrtc/api/statscollector.cc |
| index ffe241568bd4a141f17e0071276e1cbe6920f411..2f04673c63202d5ae8db40eb10a0c53363cf1c2f 100644 |
| --- a/webrtc/api/statscollector.cc |
| +++ b/webrtc/api/statscollector.cc |
| @@ -14,10 +14,16 @@ |
| #include <utility> |
| #include <vector> |
| +// StatsCollector::GetTimeNow |
| +#if defined(WEBRTC_POSIX) |
| +#include <sys/time.h> |
| +#elif defined(WEBRTC_WIN) |
| +#include <sys/timeb.h> |
| +#endif |
| + |
| #include "webrtc/api/peerconnection.h" |
| #include "webrtc/base/base64.h" |
| #include "webrtc/base/checks.h" |
| -#include "webrtc/base/timing.h" |
| #include "webrtc/pc/channel.h" |
| namespace webrtc { |
| @@ -376,7 +382,21 @@ StatsCollector::~StatsCollector() { |
| } |
| double StatsCollector::GetTimeNow() { |
| - return rtc::Timing::WallTimeNow() * rtc::kNumMillisecsPerSec; |
| + // TODO(nisse): Helper function belongs in timeutils.h. |
|
hbos
2016/08/30 12:56:40
I think this TODO should be fixed in this CL befor
nisse-webrtc
2016/08/30 13:20:25
Agreed. We only have to settle on a name.
|
| +#if defined(WEBRTC_POSIX) |
| + struct timeval time; |
| + gettimeofday(&time, NULL); |
| + // Convert from second (1.0) and microsecond (1e-6). |
| + return (static_cast<double>(time.tv_sec) + |
| + static_cast<double>(time.tv_usec) * 1.0e-6); |
| + |
| +#elif defined(WEBRTC_WIN) |
| + struct _timeb time; |
| + _ftime(&time); |
| + // Convert from second (1.0) and milliseconds (1e-3). |
| + return (static_cast<double>(time.time) + |
| + static_cast<double>(time.millitm) * 1.0e-3); |
| +#endif |
| } |
| // Adds a MediaStream with tracks that can be used as a |selector| in a call |