Run git cl format --full on the C++ files in system_wrappers/
Specifically, this CL was generated by the following shell commands: cd system_wrappers for f in $(find . -type f | grep -E '[.](h|cc)$'); do echo >> $f; done git cl format --full Followed by a revert of the changes to asm_defines.h since that file is assembly and not C++, and a manual edit to clock.cc to add some blank lines in the #include list to prevent `git cl format` from sorting <MMSystem.h> before "rtc_base/win32.h". I needed to do this because otherwise `git cl format` introduces a lot of unrelated formatting changes in other CLs that move these files (since `git cl format` will try to re-format all lines of a moved file). BUG=none Change-Id: I083e23a57ce2899add3e60bbd539f03343c7c219 Reviewed-on: https://webrtc-review.googlesource.com/21161 Reviewed-by: Henrik Andreassson <henrika@webrtc.org> Commit-Queue: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20600}
This commit is contained in:
@ -11,12 +11,17 @@
|
||||
#include "system_wrappers/include/clock.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
// Windows needs to be included before mmsystem.h
|
||||
#include "rtc_base/win32.h"
|
||||
|
||||
#include <MMSystem.h>
|
||||
|
||||
#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC))
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "rtc_base/criticalsection.h"
|
||||
@ -28,15 +33,11 @@ namespace webrtc {
|
||||
class RealTimeClock : public Clock {
|
||||
// Return a timestamp in milliseconds relative to some arbitrary source; the
|
||||
// source is fixed for this clock.
|
||||
int64_t TimeInMilliseconds() const override {
|
||||
return rtc::TimeMillis();
|
||||
}
|
||||
int64_t TimeInMilliseconds() const override { return rtc::TimeMillis(); }
|
||||
|
||||
// Return a timestamp in microseconds relative to some arbitrary source; the
|
||||
// source is fixed for this clock.
|
||||
int64_t TimeInMicroseconds() const override {
|
||||
return rtc::TimeMicros();
|
||||
}
|
||||
int64_t TimeInMicroseconds() const override { return rtc::TimeMicros(); }
|
||||
|
||||
// Retrieve an NTP absolute timestamp.
|
||||
NtpTime CurrentNtpTime() const override {
|
||||
@ -56,13 +57,14 @@ class RealTimeClock : public Clock {
|
||||
double microseconds_in_seconds;
|
||||
Adjust(tv, &seconds, µseconds_in_seconds);
|
||||
return 1000 * static_cast<int64_t>(seconds) +
|
||||
static_cast<int64_t>(1000.0 * microseconds_in_seconds + 0.5);
|
||||
static_cast<int64_t>(1000.0 * microseconds_in_seconds + 0.5);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual timeval CurrentTimeVal() const = 0;
|
||||
|
||||
static void Adjust(const timeval& tv, uint32_t* adjusted_s,
|
||||
static void Adjust(const timeval& tv,
|
||||
uint32_t* adjusted_s,
|
||||
double* adjusted_us_in_s) {
|
||||
*adjusted_s = tv.tv_sec + kNtpJan1970;
|
||||
*adjusted_us_in_s = tv.tv_usec / 1e6;
|
||||
@ -107,8 +109,8 @@ class WindowsRealTimeClock : public RealTimeClock {
|
||||
// speed stepping.
|
||||
GetTime(&StartTime);
|
||||
|
||||
Time = (((uint64_t) StartTime.dwHighDateTime) << 32) +
|
||||
(uint64_t) StartTime.dwLowDateTime;
|
||||
Time = (((uint64_t)StartTime.dwHighDateTime) << 32) +
|
||||
(uint64_t)StartTime.dwLowDateTime;
|
||||
|
||||
// Convert the hecto-nano second time to tv format.
|
||||
Time -= FILETIME_1970;
|
||||
@ -226,11 +228,9 @@ Clock* Clock::GetRealTimeClock() {
|
||||
}
|
||||
|
||||
SimulatedClock::SimulatedClock(int64_t initial_time_us)
|
||||
: time_us_(initial_time_us), lock_(RWLockWrapper::CreateRWLock()) {
|
||||
}
|
||||
: time_us_(initial_time_us), lock_(RWLockWrapper::CreateRWLock()) {}
|
||||
|
||||
SimulatedClock::~SimulatedClock() {
|
||||
}
|
||||
SimulatedClock::~SimulatedClock() {}
|
||||
|
||||
int64_t SimulatedClock::TimeInMilliseconds() const {
|
||||
ReadLockScoped synchronize(*lock_);
|
||||
|
||||
Reference in New Issue
Block a user