Erik Språng 1c3909899d Use rtc::time for all your timing needs!
Initial step of unifying so that base/timeutils.h and Clock/TimeTime
from system_wrappers use the same implementation.

BUG=webrtc:5463
R=pbos@webrtc.org, tommi@webrtc.org

Review URL: https://codereview.webrtc.org/1639543005 .

Cr-Commit-Position: refs/heads/master@{#11394}
2016-01-27 11:55:44 +00:00

43 lines
1.2 KiB
C++

/*
* Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "webrtc/system_wrappers/include/tick_util.h"
#include "webrtc/base/timeutils.h"
namespace webrtc {
int64_t TickTime::MillisecondTimestamp() {
return TicksToMilliseconds(TickTime::Now().Ticks());
}
int64_t TickTime::MicrosecondTimestamp() {
return TicksToMicroseconds(TickTime::Now().Ticks());
}
int64_t TickTime::MillisecondsToTicks(const int64_t ms) {
return ms * rtc::kNumNanosecsPerMillisec;
}
int64_t TickTime::TicksToMilliseconds(const int64_t ticks) {
return ticks / rtc::kNumNanosecsPerMillisec;
}
int64_t TickTime::TicksToMicroseconds(const int64_t ticks) {
return ticks / rtc::kNumNanosecsPerMicrosec;
}
// Gets the native system tick count, converted to nanoseconds.
int64_t TickTime::QueryOsForTicks() {
return rtc::TimeNanos();
}
} // namespace webrtc