Move video_coding to new Clock interface and remove fake clock implementations from RTP module tests.

TEST=video_coding_unittests, video_coding_integrationtests, rtp_rtcp_unittests, trybots

Review URL: https://webrtc-codereview.appspot.com/1044004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3393 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/video_coding/main/interface/video_coding.h b/webrtc/modules/video_coding/main/interface/video_coding.h
index ad7edcd..b5adf35 100644
--- a/webrtc/modules/video_coding/main/interface/video_coding.h
+++ b/webrtc/modules/video_coding/main/interface/video_coding.h
@@ -19,7 +19,7 @@
 namespace webrtc
 {
 
-class TickTimeBase;
+class Clock;
 class VideoEncoder;
 class VideoDecoder;
 struct CodecSpecificInfo;
@@ -49,7 +49,7 @@
     static VideoCodingModule* Create(const WebRtc_Word32 id);
 
     static VideoCodingModule* Create(const WebRtc_Word32 id,
-                                     TickTimeBase* clock);
+                                     Clock* clock);
 
     static void Destroy(VideoCodingModule* module);
 
diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.cc b/webrtc/modules/video_coding/main/source/generic_decoder.cc
index 3139ba8..a9bb763 100644
--- a/webrtc/modules/video_coding/main/source/generic_decoder.cc
+++ b/webrtc/modules/video_coding/main/source/generic_decoder.cc
@@ -12,12 +12,12 @@
 #include "trace.h"
 #include "generic_decoder.h"
 #include "internal_defines.h"
-#include "tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
 VCMDecodedFrameCallback::VCMDecodedFrameCallback(VCMTiming& timing,
-                                                 TickTimeBase* clock)
+                                                 Clock* clock)
 :
 _critSect(CriticalSectionWrapper::CreateCriticalSection()),
 _clock(clock),
@@ -56,7 +56,7 @@
     _timing.StopDecodeTimer(
         decodedImage.timestamp(),
         frameInfo->decodeStartTimeMs,
-        _clock->MillisecondTimestamp());
+        _clock->TimeInMilliseconds());
 
     if (_receiveCallback != NULL)
     {
diff --git a/webrtc/modules/video_coding/main/source/generic_decoder.h b/webrtc/modules/video_coding/main/source/generic_decoder.h
index 016142a..084bd76 100644
--- a/webrtc/modules/video_coding/main/source/generic_decoder.h
+++ b/webrtc/modules/video_coding/main/source/generic_decoder.h
@@ -34,7 +34,7 @@
 class VCMDecodedFrameCallback : public DecodedImageCallback
 {
 public:
-    VCMDecodedFrameCallback(VCMTiming& timing, TickTimeBase* clock);
+    VCMDecodedFrameCallback(VCMTiming& timing, Clock* clock);
     virtual ~VCMDecodedFrameCallback();
     void SetUserReceiveCallback(VCMReceiveCallback* receiveCallback);
 
@@ -49,7 +49,7 @@
 
 private:
     CriticalSectionWrapper* _critSect;
-    TickTimeBase* _clock;
+    Clock* _clock;
     I420VideoFrame _frame;
     VCMReceiveCallback* _receiveCallback;
     VCMTiming& _timing;
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.cc b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
index c80b84a..8121497 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.cc
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.cc
@@ -12,16 +12,16 @@
 #include <algorithm>
 #include <cassert>
 
-#include "modules/video_coding/main/source/event.h"
-#include "modules/video_coding/main/source/frame_buffer.h"
-#include "modules/video_coding/main/source/inter_frame_delay.h"
-#include "modules/video_coding/main/source/internal_defines.h"
-#include "modules/video_coding/main/source/jitter_buffer_common.h"
-#include "modules/video_coding/main/source/jitter_estimator.h"
-#include "modules/video_coding/main/source/packet.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
-#include "system_wrappers/interface/critical_section_wrapper.h"
-#include "system_wrappers/interface/trace.h"
+#include "webrtc/modules/video_coding/main/source/event.h"
+#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
+#include "webrtc/modules/video_coding/main/source/inter_frame_delay.h"
+#include "webrtc/modules/video_coding/main/source/internal_defines.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
+#include "webrtc/modules/video_coding/main/source/jitter_estimator.h"
+#include "webrtc/modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
 
 namespace webrtc {
 
@@ -61,7 +61,7 @@
   }
 };
 
-VCMJitterBuffer::VCMJitterBuffer(TickTimeBase* clock,
+VCMJitterBuffer::VCMJitterBuffer(Clock* clock,
                                  int vcm_id,
                                  int receiver_id,
                                  bool master)
@@ -90,7 +90,7 @@
       num_consecutive_old_packets_(0),
       num_discarded_packets_(0),
       jitter_estimate_(vcm_id, receiver_id),
-      inter_frame_delay_(clock_->MillisecondTimestamp()),
+      inter_frame_delay_(clock_->TimeInMilliseconds()),
       rtt_ms_(kDefaultRtt),
       nack_mode_(kNoNack),
       low_rtt_nack_threshold_ms_(-1),
@@ -177,7 +177,7 @@
   incoming_frame_rate_ = 0;
   incoming_bit_count_ = 0;
   incoming_bit_rate_ = 0;
-  time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
+  time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
   memset(receive_statistics_, 0, sizeof(receive_statistics_));
 
   num_consecutive_old_frames_ = 0;
@@ -241,7 +241,7 @@
   num_consecutive_old_packets_ = 0;
   // Also reset the jitter and delay estimates
   jitter_estimate_.Reset();
-  inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
+  inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
   waiting_for_completion_.frame_size = 0;
   waiting_for_completion_.timestamp = 0;
   waiting_for_completion_.latest_packet_time = -1;
@@ -278,7 +278,7 @@
   assert(framerate);
   assert(bitrate);
   CriticalSectionScoped cs(crit_sect_);
-  const int64_t now = clock_->MillisecondTimestamp();
+  const int64_t now = clock_->TimeInMilliseconds();
   int64_t diff = now - time_last_incoming_frame_count_;
   if (diff < 1000 && incoming_frame_rate_ > 0 && incoming_bit_rate_ > 0) {
     // Make sure we report something even though less than
@@ -323,7 +323,7 @@
 
   } else {
     // No frames since last call
-    time_last_incoming_frame_count_ = clock_->MillisecondTimestamp();
+    time_last_incoming_frame_count_ = clock_->TimeInMilliseconds();
     *framerate = 0;
     bitrate = 0;
     incoming_bit_rate_ = 0;
@@ -437,8 +437,8 @@
       crit_sect_->Leave();
       return NULL;
     }
-    const int64_t end_wait_time_ms = clock_->MillisecondTimestamp()
-                                           + max_wait_time_ms;
+    const int64_t end_wait_time_ms = clock_->TimeInMilliseconds() +
+        max_wait_time_ms;
     int64_t wait_time_ms = max_wait_time_ms;
     while (wait_time_ms > 0) {
       crit_sect_->Leave();
@@ -457,8 +457,7 @@
         CleanUpOldFrames();
         it = FindOldestCompleteContinuousFrame(false);
         if (it == frame_list_.end()) {
-          wait_time_ms = end_wait_time_ms -
-                         clock_->MillisecondTimestamp();
+          wait_time_ms = end_wait_time_ms - clock_->TimeInMilliseconds();
         } else {
           break;
         }
@@ -663,7 +662,7 @@
                                                  const VCMPacket& packet) {
   assert(encoded_frame);
   CriticalSectionScoped cs(crit_sect_);
-  int64_t now_ms = clock_->MillisecondTimestamp();
+  int64_t now_ms = clock_->TimeInMilliseconds();
   VCMFrameBufferEnum buffer_return = kSizeError;
   VCMFrameBufferEnum ret = kSizeError;
   VCMFrameBuffer* frame = static_cast<VCMFrameBuffer*>(encoded_frame);
@@ -673,7 +672,7 @@
   if (first_packet_) {
     // Now it's time to start estimating jitter
     // reset the delay estimate.
-    inter_frame_delay_.Reset(clock_->MillisecondTimestamp());
+    inter_frame_delay_.Reset(clock_->TimeInMilliseconds());
     first_packet_ = false;
   }
 
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer.h b/webrtc/modules/video_coding/main/source/jitter_buffer.h
index 5b30fb8..d0a2569 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer.h
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer.h
@@ -35,7 +35,7 @@
 typedef std::list<VCMFrameBuffer*> FrameList;
 
 // forward declarations
-class TickTimeBase;
+class Clock;
 class VCMFrameBuffer;
 class VCMPacket;
 class VCMEncodedFrame;
@@ -49,7 +49,7 @@
 
 class VCMJitterBuffer {
  public:
-  VCMJitterBuffer(TickTimeBase* clock, int vcm_id = -1, int receiver_id = -1,
+  VCMJitterBuffer(Clock* clock, int vcm_id = -1, int receiver_id = -1,
                   bool master = true);
   virtual ~VCMJitterBuffer();
 
@@ -206,7 +206,7 @@
 
   int vcm_id_;
   int receiver_id_;
-  TickTimeBase* clock_;
+  Clock* clock_;
   // If we are running (have started) or not.
   bool running_;
   CriticalSectionWrapper* crit_sect_;
diff --git a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
index 88ca597..af79442 100644
--- a/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
+++ b/webrtc/modules/video_coding/main/source/jitter_buffer_unittest.cc
@@ -15,8 +15,8 @@
 #include "gtest/gtest.h"
 #include "modules/video_coding/main/source/jitter_buffer.h"
 #include "modules/video_coding/main/source/media_opt_util.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
 #include "modules/video_coding/main/source/packet.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
@@ -145,10 +145,10 @@
   enum { kDefaultFramePeriodMs = 1000 / kDefaultFrameRate };
 
   virtual void SetUp() {
-    clock_ = new FakeTickTime(0);
-    jitter_buffer_ = new VCMJitterBuffer(clock_);
+    clock_.reset(new SimulatedClock(0));
+    jitter_buffer_ = new VCMJitterBuffer(clock_.get());
     stream_generator = new StreamGenerator(0, 0,
-                                           clock_->MillisecondTimestamp());
+                                           clock_->TimeInMilliseconds());
     jitter_buffer_->Start();
     memset(data_buffer_, 0, kDataBufferSize);
   }
@@ -157,7 +157,6 @@
     jitter_buffer_->Stop();
     delete stream_generator;
     delete jitter_buffer_;
-    delete clock_;
   }
 
   VCMFrameBufferEnum InsertPacketAndPop(int index) {
@@ -190,9 +189,9 @@
     stream_generator->GenerateFrame(frame_type,
                                     (frame_type != kFrameEmpty) ? 1 : 0,
                                     (frame_type == kFrameEmpty) ? 1 : 0,
-                                    clock_->MillisecondTimestamp());
+                                    clock_->TimeInMilliseconds());
     EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
-    clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+    clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
   }
 
   void InsertFrames(int num_frames, FrameType frame_type) {
@@ -203,8 +202,8 @@
 
   void DropFrame(int num_packets) {
     stream_generator->GenerateFrame(kVideoFrameDelta, num_packets, 0,
-                                    clock_->MillisecondTimestamp());
-    clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+                                    clock_->TimeInMilliseconds());
+    clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
   }
 
   bool DecodeCompleteFrame() {
@@ -223,7 +222,7 @@
 
   VCMJitterBuffer* jitter_buffer_;
   StreamGenerator* stream_generator;
-  FakeTickTime* clock_;
+  scoped_ptr<SimulatedClock> clock_;
   uint8_t data_buffer_[kDataBufferSize];
 };
 
@@ -258,7 +257,7 @@
 TEST_F(TestRunningJitterBuffer, TestEmptyPackets) {
   // Make sure a frame can get complete even though empty packets are missing.
   stream_generator->GenerateFrame(kVideoFrameKey, 3, 3,
-                                  clock_->MillisecondTimestamp());
+                                  clock_->TimeInMilliseconds());
   EXPECT_EQ(kFirstPacket, InsertPacketAndPop(4));
   EXPECT_EQ(kIncomplete, InsertPacketAndPop(4));
   EXPECT_EQ(kIncomplete, InsertPacketAndPop(0));
@@ -319,8 +318,8 @@
   // | 1 | 2 | .. | 8 | 9 | x | 11 | 12 | .. | 19 | x | 21 | .. | 100 |
   //  ----------------------------------------------------------------
   stream_generator->GenerateFrame(kVideoFrameKey, 100, 0,
-                                  clock_->MillisecondTimestamp());
-  clock_->IncrementDebugClock(kDefaultFramePeriodMs);
+                                  clock_->TimeInMilliseconds());
+  clock_->AdvanceTimeMilliseconds(kDefaultFramePeriodMs);
   EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
   // Verify that the frame is incomplete.
   EXPECT_FALSE(DecodeCompleteFrame());
@@ -348,11 +347,11 @@
   //  -------   ------------------------------------------------------------
   // | 65532 | | 65533 | 65534 | 65535 | x | 1 | .. | 9 | x | 11 |.....| 96 |
   //  -------   ------------------------------------------------------------
-  stream_generator->Init(65532, 0, clock_->MillisecondTimestamp());
+  stream_generator->Init(65532, 0, clock_->TimeInMilliseconds());
   InsertFrame(kVideoFrameKey);
   EXPECT_TRUE(DecodeCompleteFrame());
   stream_generator->GenerateFrame(kVideoFrameDelta, 100, 0,
-                                  clock_->MillisecondTimestamp());
+                                  clock_->TimeInMilliseconds());
   EXPECT_EQ(kFirstPacket, InsertPacketAndPop(0));
   while (stream_generator->PacketsRemaining() > 1) {
     if (stream_generator->NextSequenceNumber() % 10 != 0)
diff --git a/webrtc/modules/video_coding/main/source/media_optimization.cc b/webrtc/modules/video_coding/main/source/media_optimization.cc
index 8dd47fc..dd428b4 100644
--- a/webrtc/modules/video_coding/main/source/media_optimization.cc
+++ b/webrtc/modules/video_coding/main/source/media_optimization.cc
@@ -13,12 +13,12 @@
 #include "content_metrics_processing.h"
 #include "frame_dropper.h"
 #include "qm_select.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
 VCMMediaOptimization::VCMMediaOptimization(WebRtc_Word32 id,
-                                           TickTimeBase* clock):
+                                           Clock* clock):
 _id(id),
 _clock(clock),
 _maxBitRate(0),
@@ -46,7 +46,7 @@
     memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
 
     _frameDropper  = new VCMFrameDropper(_id);
-    _lossProtLogic = new VCMLossProtectionLogic(_clock->MillisecondTimestamp());
+    _lossProtLogic = new VCMLossProtectionLogic(_clock->TimeInMilliseconds());
     _content = new VCMContentMetricsProcessing();
     _qmResolution = new VCMQmResolution();
 }
@@ -66,12 +66,12 @@
     memset(_incomingFrameTimes, -1, sizeof(_incomingFrameTimes));
     _incomingFrameRate = 0.0;
     _frameDropper->Reset();
-    _lossProtLogic->Reset(_clock->MillisecondTimestamp());
+    _lossProtLogic->Reset(_clock->TimeInMilliseconds());
     _frameDropper->SetRates(0, 0);
     _content->Reset();
     _qmResolution->Reset();
     _lossProtLogic->UpdateFrameRate(_incomingFrameRate);
-    _lossProtLogic->Reset(_clock->MillisecondTimestamp());
+    _lossProtLogic->Reset(_clock->TimeInMilliseconds());
     _sendStatisticsZeroEncode = 0;
     _targetBitRate = 0;
     _codecWidth = 0;
@@ -122,7 +122,7 @@
     // Use max window filter for now.
     FilterPacketLossMode filter_mode = kMaxFilter;
     WebRtc_UWord8 packetLossEnc = _lossProtLogic->FilteredLoss(
-        _clock->MillisecondTimestamp(), filter_mode, fractionLost);
+        _clock->TimeInMilliseconds(), filter_mode, fractionLost);
 
     // For now use the filtered loss for computing the robustness settings
     _lossProtLogic->UpdateFilteredLossPr(packetLossEnc);
@@ -274,7 +274,7 @@
     // has changed. If native dimension values have changed, then either user
     // initiated change, or QM initiated change. Will be able to determine only
     // after the processing of the first frame.
-    _lastChangeTime = _clock->MillisecondTimestamp();
+    _lastChangeTime = _clock->TimeInMilliseconds();
     _content->Reset();
     _content->UpdateFrameRate(frameRate);
 
@@ -359,7 +359,7 @@
 float
 VCMMediaOptimization::SentBitRate()
 {
-    UpdateBitRateEstimate(-1, _clock->MillisecondTimestamp());
+    UpdateBitRateEstimate(-1, _clock->TimeInMilliseconds());
     return _avgSentBitRateBps / 1000.0f;
 }
 
@@ -374,7 +374,7 @@
                                             FrameType encodedFrameType)
 {
     // look into the ViE version - debug mode - needs also number of layers.
-    UpdateBitRateEstimate(encodedLength, _clock->MillisecondTimestamp());
+    UpdateBitRateEstimate(encodedLength, _clock->TimeInMilliseconds());
     if(encodedLength > 0)
     {
         const bool deltaFrame = (encodedFrameType != kVideoFrameKey &&
@@ -388,12 +388,12 @@
             if (deltaFrame)
             {
                 _lossProtLogic->UpdatePacketsPerFrame(
-                    minPacketsPerFrame, _clock->MillisecondTimestamp());
+                    minPacketsPerFrame, _clock->TimeInMilliseconds());
             }
             else
             {
                 _lossProtLogic->UpdatePacketsPerFrameKey(
-                    minPacketsPerFrame, _clock->MillisecondTimestamp());
+                    minPacketsPerFrame, _clock->TimeInMilliseconds());
             }
 
             if (_enableQm)
@@ -544,7 +544,7 @@
     _qmResolution->ResetRates();
 
     // Reset counters
-    _lastQMUpdateTime = _clock->MillisecondTimestamp();
+    _lastQMUpdateTime = _clock->TimeInMilliseconds();
 
     // Reset content metrics
     _content->Reset();
@@ -567,7 +567,7 @@
     // (to sample the metrics) from the event lastChangeTime
     // lastChangeTime is the time where user changed the size/rate/frame rate
     // (via SetEncodingData)
-    WebRtc_Word64 now = _clock->MillisecondTimestamp();
+    WebRtc_Word64 now = _clock->TimeInMilliseconds();
     if ((now - _lastQMUpdateTime) < kQmMinIntervalMs ||
         (now  - _lastChangeTime) <  kQmMinIntervalMs)
     {
@@ -619,7 +619,7 @@
 void
 VCMMediaOptimization::UpdateIncomingFrameRate()
 {
-    WebRtc_Word64 now = _clock->MillisecondTimestamp();
+    WebRtc_Word64 now = _clock->TimeInMilliseconds();
     if (_incomingFrameTimes[0] == 0)
     {
         // first no shift
@@ -667,7 +667,7 @@
 WebRtc_UWord32
 VCMMediaOptimization::InputFrameRate()
 {
-    ProcessIncomingFrameRate(_clock->MillisecondTimestamp());
+    ProcessIncomingFrameRate(_clock->TimeInMilliseconds());
     return WebRtc_UWord32 (_incomingFrameRate + 0.5f);
 }
 
diff --git a/webrtc/modules/video_coding/main/source/media_optimization.h b/webrtc/modules/video_coding/main/source/media_optimization.h
index 3b6c978..a642c5d 100644
--- a/webrtc/modules/video_coding/main/source/media_optimization.h
+++ b/webrtc/modules/video_coding/main/source/media_optimization.h
@@ -23,7 +23,7 @@
 enum { kBitrateMaxFrameSamples = 60 };
 enum { kBitrateAverageWinMs    = 1000 };
 
-class TickTimeBase;
+class Clock;
 class VCMContentMetricsProcessing;
 class VCMFrameDropper;
 
@@ -38,7 +38,7 @@
 class VCMMediaOptimization
 {
 public:
-    VCMMediaOptimization(WebRtc_Word32 id, TickTimeBase* clock);
+    VCMMediaOptimization(WebRtc_Word32 id, Clock* clock);
     ~VCMMediaOptimization(void);
     /*
     * Reset the Media Optimization module
@@ -163,7 +163,7 @@
     enum { kFrameHistoryWinMs = 2000};
 
     WebRtc_Word32                     _id;
-    TickTimeBase*                     _clock;
+    Clock*                            _clock;
     WebRtc_Word32                     _maxBitRate;
     VideoCodecType                    _sendCodecType;
     WebRtc_UWord16                    _codecWidth;
diff --git a/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h b/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h
deleted file mode 100644
index c6da348..0000000
--- a/webrtc/modules/video_coding/main/source/mock/fake_tick_time.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2011 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.
- */
-
-#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
-#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
-
-#include <assert.h>
-
-#include <limits>
-
-#include "modules/video_coding/main/source/tick_time_base.h"
-
-namespace webrtc {
-
-// Provides a fake implementation of TickTimeBase, intended for offline
-// testing. This implementation does not query the system clock, but returns a
-// time value set by the user when creating the object, and incremented with
-// the method IncrementDebugClock.
-class FakeTickTime : public TickTimeBase {
- public:
-  explicit FakeTickTime(int64_t start_time_ms) : fake_now_ms_(start_time_ms) {}
-  virtual ~FakeTickTime() {}
-  virtual int64_t MillisecondTimestamp() const {
-    return fake_now_ms_;
-  }
-  virtual int64_t MicrosecondTimestamp() const {
-    return 1000 * fake_now_ms_;
-  }
-  virtual void IncrementDebugClock(int64_t increase_ms) {
-    assert(increase_ms <= std::numeric_limits<int64_t>::max() - fake_now_ms_);
-    fake_now_ms_ += increase_ms;
-  }
-
- private:
-  int64_t fake_now_ms_;
-};
-
-}  // namespace
-
-#endif  // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_MOCK_FAKE_TICK_TIME_H_
diff --git a/webrtc/modules/video_coding/main/source/receiver.cc b/webrtc/modules/video_coding/main/source/receiver.cc
index ce209e1..efb3ecd 100644
--- a/webrtc/modules/video_coding/main/source/receiver.cc
+++ b/webrtc/modules/video_coding/main/source/receiver.cc
@@ -16,13 +16,13 @@
 #include "webrtc/modules/video_coding/main/source/encoded_frame.h"
 #include "webrtc/modules/video_coding/main/source/internal_defines.h"
 #include "webrtc/modules/video_coding/main/source/media_opt_util.h"
-#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 #include "webrtc/system_wrappers/interface/trace.h"
 
 namespace webrtc {
 
 VCMReceiver::VCMReceiver(VCMTiming* timing,
-                         TickTimeBase* clock,
+                         Clock* clock,
                          int32_t vcm_id,
                          int32_t receiver_id,
                          bool master)
@@ -95,10 +95,10 @@
                    VCMId(vcm_id_, receiver_id_),
                    "Packet seq_no %u of frame %u at %u",
                    packet.seqNum, packet.timestamp,
-                   MaskWord64ToUWord32(clock_->MillisecondTimestamp()));
+                   MaskWord64ToUWord32(clock_->TimeInMilliseconds()));
     }
 
-    const int64_t now_ms = clock_->MillisecondTimestamp();
+    const int64_t now_ms = clock_->TimeInMilliseconds();
 
     int64_t render_time_ms = timing_->RenderTimeMs(packet.timestamp, now_ms);
 
@@ -106,7 +106,7 @@
       // Render time error. Assume that this is due to some change in the
       // incoming video stream and reset the JB and the timing.
       jitter_buffer_.Flush();
-      timing_->Reset(clock_->MillisecondTimestamp());
+      timing_->Reset(clock_->TimeInMilliseconds());
       return VCM_FLUSH_INDICATOR;
     } else if (render_time_ms < now_ms - kMaxVideoDelayMs) {
       WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
@@ -115,7 +115,7 @@
                    "Flushing jitter buffer and resetting timing.",
                    kMaxVideoDelayMs);
       jitter_buffer_.Flush();
-      timing_->Reset(clock_->MillisecondTimestamp());
+      timing_->Reset(clock_->TimeInMilliseconds());
       return VCM_FLUSH_INDICATOR;
     } else if (timing_->TargetVideoDelay() > kMaxVideoDelayMs) {
       WEBRTC_TRACE(webrtc::kTraceWarning, webrtc::kTraceVideoCoding,
@@ -123,13 +123,13 @@
                    "More than %u ms target delay. Flushing jitter buffer and"
                    "resetting timing.", kMaxVideoDelayMs);
       jitter_buffer_.Flush();
-      timing_->Reset(clock_->MillisecondTimestamp());
+      timing_->Reset(clock_->TimeInMilliseconds());
       return VCM_FLUSH_INDICATOR;
     }
 
     // First packet received belonging to this frame.
     if (buffer->Length() == 0) {
-      const int64_t now_ms = clock_->MillisecondTimestamp();
+      const int64_t now_ms = clock_->TimeInMilliseconds();
       if (master_) {
         // Only trace the primary receiver to make it possible to parse and plot
         // the trace file.
@@ -171,7 +171,7 @@
   // is thread-safe.
   FrameType incoming_frame_type = kVideoFrameDelta;
   next_render_time_ms = -1;
-  const int64_t start_time_ms = clock_->MillisecondTimestamp();
+  const int64_t start_time_ms = clock_->TimeInMilliseconds();
   int64_t ret = jitter_buffer_.NextTimestamp(max_wait_time_ms,
                                              &incoming_frame_type,
                                              &next_render_time_ms);
@@ -186,7 +186,7 @@
   timing_->UpdateCurrentDelay(time_stamp);
 
   const int32_t temp_wait_time = max_wait_time_ms -
-      static_cast<int32_t>(clock_->MillisecondTimestamp() - start_time_ms);
+      static_cast<int32_t>(clock_->TimeInMilliseconds() - start_time_ms);
   uint16_t new_max_wait_time = static_cast<uint16_t>(VCM_MAX(temp_wait_time,
                                                              0));
 
@@ -223,7 +223,7 @@
     VCMReceiver* dual_receiver) {
   // How long can we wait until we must decode the next frame.
   uint32_t wait_time_ms = timing_->MaxWaitingTime(
-      next_render_time_ms, clock_->MillisecondTimestamp());
+      next_render_time_ms, clock_->TimeInMilliseconds());
 
   // Try to get a complete frame from the jitter buffer.
   VCMEncodedFrame* frame = jitter_buffer_.GetCompleteFrameForDecoding(0);
@@ -257,7 +257,7 @@
   if (frame == NULL) {
     // Get an incomplete frame.
     if (timing_->MaxWaitingTime(next_render_time_ms,
-                                clock_->MillisecondTimestamp()) > 0) {
+                                clock_->TimeInMilliseconds()) > 0) {
       // Still time to wait for a complete frame.
       return NULL;
     }
@@ -286,7 +286,7 @@
   // frame to the decoder, which will render the frame as soon as it has been
   // decoded.
   uint32_t wait_time_ms = timing_->MaxWaitingTime(
-      next_render_time_ms, clock_->MillisecondTimestamp());
+      next_render_time_ms, clock_->TimeInMilliseconds());
   if (max_wait_time_ms < wait_time_ms) {
     // If we're not allowed to wait until the frame is supposed to be rendered
     // we will have to return NULL for now.
diff --git a/webrtc/modules/video_coding/main/source/receiver.h b/webrtc/modules/video_coding/main/source/receiver.h
index 9546f18..9d18e24 100644
--- a/webrtc/modules/video_coding/main/source/receiver.h
+++ b/webrtc/modules/video_coding/main/source/receiver.h
@@ -14,11 +14,11 @@
 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
 #include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
 #include "webrtc/modules/video_coding/main/source/packet.h"
-#include "webrtc/modules/video_coding/main/source/tick_time_base.h"
 #include "webrtc/modules/video_coding/main/source/timing.h"
 
 namespace webrtc {
 
+class Clock;
 class VCMEncodedFrame;
 
 enum VCMNackStatus {
@@ -36,7 +36,7 @@
 class VCMReceiver {
  public:
   VCMReceiver(VCMTiming* timing,
-              TickTimeBase* clock,
+              Clock* clock,
               int32_t vcm_id = -1,
               int32_t receiver_id = -1,
               bool master = true);
@@ -81,7 +81,7 @@
 
   CriticalSectionWrapper* crit_sect_;
   int32_t vcm_id_;
-  TickTimeBase* clock_;
+  Clock* clock_;
   int32_t receiver_id_;
   bool master_;
   VCMJitterBuffer jitter_buffer_;
diff --git a/webrtc/modules/video_coding/main/source/tick_time_base.h b/webrtc/modules/video_coding/main/source/tick_time_base.h
deleted file mode 100644
index a212591..0000000
--- a/webrtc/modules/video_coding/main/source/tick_time_base.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *  Copyright (c) 2011 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.
- */
-
-#ifndef WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
-#define WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
-
-#include "system_wrappers/interface/tick_util.h"
-
-namespace webrtc {
-
-// This class provides a mockable wrapper to TickTime.
-class TickTimeBase {
- public:
-  virtual ~TickTimeBase() {}
-
-  // "Now" in milliseconds.
-  virtual int64_t MillisecondTimestamp() const {
-    return TickTime::MillisecondTimestamp();
-  }
-
-  // "Now" in microseconds.
-  virtual int64_t MicrosecondTimestamp() const {
-    return TickTime::MicrosecondTimestamp();
-  }
-};
-
-}  // namespace
-
-#endif  // WEBRTC_MODULES_VIDEO_CODING_MAIN_SOURCE_TICK_TIME_BASE_H_
diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
index e272eb9..37ebbdd 100644
--- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
+++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.cc
@@ -9,13 +9,13 @@
  */
 
 #include "internal_defines.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "timestamp_extrapolator.h"
 #include "trace.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
-VCMTimestampExtrapolator::VCMTimestampExtrapolator(TickTimeBase* clock,
+VCMTimestampExtrapolator::VCMTimestampExtrapolator(Clock* clock,
                                                    WebRtc_Word32 vcmId,
                                                    WebRtc_Word32 id)
 :
@@ -38,7 +38,7 @@
 _accMaxError(7000),
 _P11(1e10)
 {
-    Reset(_clock->MillisecondTimestamp());
+    Reset(_clock->TimeInMilliseconds());
 }
 
 VCMTimestampExtrapolator::~VCMTimestampExtrapolator()
@@ -56,7 +56,7 @@
     }
     else
     {
-        _startMs = _clock->MillisecondTimestamp();
+        _startMs = _clock->TimeInMilliseconds();
     }
     _prevMs = _startMs;
     _firstTimestamp = 0;
diff --git a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
index 901d8d4..1661f54 100644
--- a/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
+++ b/webrtc/modules/video_coding/main/source/timestamp_extrapolator.h
@@ -17,12 +17,12 @@
 namespace webrtc
 {
 
-class TickTimeBase;
+class Clock;
 
 class VCMTimestampExtrapolator
 {
 public:
-    VCMTimestampExtrapolator(TickTimeBase* clock,
+    VCMTimestampExtrapolator(Clock* clock,
                              WebRtc_Word32 vcmId = 0,
                              WebRtc_Word32 receiverId = 0);
     ~VCMTimestampExtrapolator();
@@ -37,16 +37,16 @@
     RWLockWrapper*        _rwLock;
     WebRtc_Word32         _vcmId;
     WebRtc_Word32         _id;
-    TickTimeBase*         _clock;
-    double              _w[2];
-    double              _P[2][2];
+    Clock*                _clock;
+    double                _w[2];
+    double                _P[2][2];
     WebRtc_Word64         _startMs;
     WebRtc_Word64         _prevMs;
     WebRtc_UWord32        _firstTimestamp;
     WebRtc_Word32         _wrapArounds;
     WebRtc_UWord32        _prevTs90khz;
-    const double        _lambda;
-    bool                _firstAfterReset;
+    const double          _lambda;
+    bool                  _firstAfterReset;
     WebRtc_UWord32        _packetCount;
     const WebRtc_UWord32  _startUpFilterDelayInPackets;
 
diff --git a/webrtc/modules/video_coding/main/source/timing.cc b/webrtc/modules/video_coding/main/source/timing.cc
index aca05fa..36131b1 100644
--- a/webrtc/modules/video_coding/main/source/timing.cc
+++ b/webrtc/modules/video_coding/main/source/timing.cc
@@ -8,15 +8,17 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "trace.h"
-#include "internal_defines.h"
-#include "jitter_buffer_common.h"
-#include "timing.h"
-#include "timestamp_extrapolator.h"
+#include "webrtc/modules/video_coding/main/source/timing.h"
+
+#include "webrtc/modules/video_coding/main/source/internal_defines.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer_common.h"
+#include "webrtc/modules/video_coding/main/source/timestamp_extrapolator.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/trace.h"
 
 namespace webrtc {
 
-VCMTiming::VCMTiming(TickTimeBase* clock,
+VCMTiming::VCMTiming(Clock* clock,
                      WebRtc_Word32 vcmId,
                      WebRtc_Word32 timingId,
                      VCMTiming* masterTiming)
diff --git a/webrtc/modules/video_coding/main/source/timing.h b/webrtc/modules/video_coding/main/source/timing.h
index 41a4945..ac650ec 100644
--- a/webrtc/modules/video_coding/main/source/timing.h
+++ b/webrtc/modules/video_coding/main/source/timing.h
@@ -18,7 +18,7 @@
 namespace webrtc
 {
 
-class TickTimeBase;
+class Clock;
 class VCMTimestampExtrapolator;
 
 class VCMTiming
@@ -26,7 +26,7 @@
 public:
     // The primary timing component should be passed
     // if this is the dual timing component.
-    VCMTiming(TickTimeBase* clock,
+    VCMTiming(Clock* clock,
               WebRtc_Word32 vcmId = 0,
               WebRtc_Word32 timingId = 0,
               VCMTiming* masterTiming = NULL);
@@ -94,7 +94,7 @@
 private:
     CriticalSectionWrapper*       _critSect;
     WebRtc_Word32                 _vcmId;
-    TickTimeBase*                 _clock;
+    Clock*                        _clock;
     WebRtc_Word32                 _timingId;
     bool                          _master;
     VCMTimestampExtrapolator*     _tsExtrapolator;
diff --git a/webrtc/modules/video_coding/main/source/video_coding.gypi b/webrtc/modules/video_coding/main/source/video_coding.gypi
index 2b9d4bd..b795f90 100644
--- a/webrtc/modules/video_coding/main/source/video_coding.gypi
+++ b/webrtc/modules/video_coding/main/source/video_coding.gypi
@@ -62,7 +62,6 @@
         'receiver.h',
         'rtt_filter.h',
         'session_info.h',
-        'tick_time_base.h',
         'timestamp_extrapolator.h',
         'timestamp_map.h',
         'timing.h',
diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.cc b/webrtc/modules/video_coding/main/source/video_coding_impl.cc
index 8fba7de..11725ad 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_impl.cc
+++ b/webrtc/modules/video_coding/main/source/video_coding_impl.cc
@@ -16,7 +16,7 @@
 #include "packet.h"
 #include "trace.h"
 #include "video_codec_interface.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc
 {
@@ -34,22 +34,20 @@
 {
     return static_cast<WebRtc_UWord32>(
         VCM_MAX(static_cast<WebRtc_Word64>(_periodMs) -
-                (_clock->MillisecondTimestamp() - _latestMs), 0));
+                (_clock->TimeInMilliseconds() - _latestMs), 0));
 }
 
 void
 VCMProcessTimer::Processed()
 {
-    _latestMs = _clock->MillisecondTimestamp();
+    _latestMs = _clock->TimeInMilliseconds();
 }
 
 VideoCodingModuleImpl::VideoCodingModuleImpl(const WebRtc_Word32 id,
-                                             TickTimeBase* clock,
-                                             bool delete_clock_on_destroy)
+                                             Clock* clock)
 :
 _id(id),
 clock_(clock),
-delete_clock_on_destroy_(delete_clock_on_destroy),
 _receiveCritSect(CriticalSectionWrapper::CreateCriticalSection()),
 _receiverInited(false),
 _timing(clock_, id, 1),
@@ -99,7 +97,6 @@
     }
     delete _receiveCritSect;
     delete _sendCritSect;
-    if (delete_clock_on_destroy_) delete clock_;
 #ifdef DEBUG_DECODER_BIT_STREAM
     fclose(_bitStreamBeforeDecoder);
 #endif
@@ -112,14 +109,14 @@
 VideoCodingModule*
 VideoCodingModule::Create(const WebRtc_Word32 id)
 {
-    return new VideoCodingModuleImpl(id, new TickTimeBase(), true);
+    return new VideoCodingModuleImpl(id, Clock::GetRealTimeClock());
 }
 
 VideoCodingModule*
-VideoCodingModule::Create(const WebRtc_Word32 id, TickTimeBase* clock)
+VideoCodingModule::Create(const WebRtc_Word32 id, Clock* clock)
 {
     assert(clock);
-    return new VideoCodingModuleImpl(id, clock, false);
+    return new VideoCodingModuleImpl(id, clock);
 }
 
 void
@@ -890,7 +887,7 @@
 
         // If this frame was too late, we should adjust the delay accordingly
         _timing.UpdateCurrentDelay(frame->RenderTimeMs(),
-                                   clock_->MillisecondTimestamp());
+                                   clock_->TimeInMilliseconds());
 
 #ifdef DEBUG_DECODER_BIT_STREAM
         if (_bitStreamBeforeDecoder != NULL)
@@ -1001,7 +998,7 @@
                      dualFrame->TimeStamp());
         // Decode dualFrame and try to catch up
         WebRtc_Word32 ret = _dualDecoder->Decode(*dualFrame,
-                                                 clock_->MillisecondTimestamp());
+                                                 clock_->TimeInMilliseconds());
         if (ret != WEBRTC_VIDEO_CODEC_OK)
         {
             WEBRTC_TRACE(webrtc::kTraceWarning,
@@ -1049,7 +1046,7 @@
         return VCM_NO_CODEC_REGISTERED;
     }
     // Decode a frame
-    WebRtc_Word32 ret = _decoder->Decode(frame, clock_->MillisecondTimestamp());
+    WebRtc_Word32 ret = _decoder->Decode(frame, clock_->TimeInMilliseconds());
 
     // Check for failed decoding, run frame type request callback if needed.
     if (ret < 0)
diff --git a/webrtc/modules/video_coding/main/source/video_coding_impl.h b/webrtc/modules/video_coding/main/source/video_coding_impl.h
index 80e3c81..e09872e 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_impl.h
+++ b/webrtc/modules/video_coding/main/source/video_coding_impl.h
@@ -15,16 +15,16 @@
 
 #include <vector>
 
-#include "modules/video_coding/main/source/codec_database.h"
-#include "modules/video_coding/main/source/frame_buffer.h"
-#include "modules/video_coding/main/source/generic_decoder.h"
-#include "modules/video_coding/main/source/generic_encoder.h"
-#include "modules/video_coding/main/source/jitter_buffer.h"
-#include "modules/video_coding/main/source/media_optimization.h"
-#include "modules/video_coding/main/source/receiver.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
-#include "modules/video_coding/main/source/timing.h"
-#include "system_wrappers/interface/critical_section_wrapper.h"
+#include "webrtc/modules/video_coding/main/source/codec_database.h"
+#include "webrtc/modules/video_coding/main/source/frame_buffer.h"
+#include "webrtc/modules/video_coding/main/source/generic_decoder.h"
+#include "webrtc/modules/video_coding/main/source/generic_encoder.h"
+#include "webrtc/modules/video_coding/main/source/jitter_buffer.h"
+#include "webrtc/modules/video_coding/main/source/media_optimization.h"
+#include "webrtc/modules/video_coding/main/source/receiver.h"
+#include "webrtc/modules/video_coding/main/source/timing.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
 
 namespace webrtc
 {
@@ -32,16 +32,16 @@
 class VCMProcessTimer
 {
 public:
-    VCMProcessTimer(WebRtc_UWord32 periodMs, TickTimeBase* clock)
+    VCMProcessTimer(WebRtc_UWord32 periodMs, Clock* clock)
         : _clock(clock),
           _periodMs(periodMs),
-          _latestMs(_clock->MillisecondTimestamp()) {}
+          _latestMs(_clock->TimeInMilliseconds()) {}
     WebRtc_UWord32 Period() const;
     WebRtc_UWord32 TimeUntilProcess() const;
     void Processed();
 
 private:
-    TickTimeBase*         _clock;
+    Clock*                _clock;
     WebRtc_UWord32        _periodMs;
     WebRtc_Word64         _latestMs;
 };
@@ -59,8 +59,7 @@
 {
 public:
     VideoCodingModuleImpl(const WebRtc_Word32 id,
-                          TickTimeBase* clock,
-                          bool delete_clock_on_destroy);
+                          Clock* clock);
 
     virtual ~VideoCodingModuleImpl();
 
@@ -275,8 +274,7 @@
 
 private:
     WebRtc_Word32                       _id;
-    TickTimeBase*                       clock_;
-    bool                                delete_clock_on_destroy_;
+    Clock*                              clock_;
     CriticalSectionWrapper*             _receiveCritSect;
     bool                                _receiverInited;
     VCMTiming                           _timing;
diff --git a/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc b/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
index 0ee9657..ccf37eb 100644
--- a/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
+++ b/webrtc/modules/video_coding/main/source/video_coding_robustness_unittest.cc
@@ -13,7 +13,7 @@
 #include "modules/video_coding/codecs/interface/mock/mock_video_codec_interface.h"
 #include "modules/video_coding/main/interface/video_coding.h"
 #include "modules/video_coding/main/interface/mock/mock_vcm_callbacks.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
@@ -32,9 +32,9 @@
   static const size_t kPayloadLen = 10;
 
   virtual void SetUp() {
-    clock_ = new FakeTickTime(0);
-    ASSERT_TRUE(clock_ != NULL);
-    vcm_ = VideoCodingModule::Create(0, clock_);
+    clock_.reset(new SimulatedClock(0));
+    ASSERT_TRUE(clock_.get() != NULL);
+    vcm_ = VideoCodingModule::Create(0, clock_.get());
     ASSERT_TRUE(vcm_ != NULL);
     ASSERT_EQ(0, vcm_->InitializeReceiver());
     ASSERT_EQ(0, vcm_->RegisterFrameTypeCallback(&frame_type_callback_));
@@ -48,7 +48,6 @@
 
   virtual void TearDown() {
     VideoCodingModule::Destroy(vcm_);
-    delete clock_;
   }
 
   void InsertPacket(uint32_t timestamp,
@@ -77,7 +76,7 @@
   MockPacketRequestCallback request_callback_;
   NiceMock<MockVideoDecoder> decoder_;
   NiceMock<MockVideoDecoder> decoderCopy_;
-  FakeTickTime* clock_;
+  scoped_ptr<SimulatedClock> clock_;
 };
 
 TEST_F(VCMRobustnessTest, TestHardNack) {
@@ -112,21 +111,21 @@
   ASSERT_EQ(VCM_OK, vcm_->Decode(0));
   ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
 
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
 
   ASSERT_EQ(VCM_OK, vcm_->Process());
 
   ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
 
   InsertPacket(6000, 8, false, true, kVideoFrameDelta);
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
   ASSERT_EQ(VCM_OK, vcm_->Process());
 
   ASSERT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
 
   InsertPacket(6000, 6, true, false, kVideoFrameDelta);
   InsertPacket(6000, 7, false, false, kVideoFrameDelta);
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
   ASSERT_EQ(VCM_OK, vcm_->Process());
 
   ASSERT_EQ(VCM_OK, vcm_->Decode(0));
@@ -149,7 +148,7 @@
   EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
   ASSERT_EQ(VCM_OK, vcm_->Process());
 
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
 
   EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
   ASSERT_EQ(VCM_OK, vcm_->Process());
@@ -217,13 +216,13 @@
   InsertPacket(0, 2, false, true, kVideoFrameKey);
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 0.
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(3000, 3, true, false, kVideoFrameDelta);
   // Packet 4 missing
   InsertPacket(3000, 5, false, true, kVideoFrameDelta);
   EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(6000, 6, true, false, kVideoFrameDelta);
   InsertPacket(6000, 7, false, false, kVideoFrameDelta);
   InsertPacket(6000, 8, false, true, kVideoFrameDelta);
@@ -232,7 +231,7 @@
                                        // Spawn a decoder copy.
   EXPECT_EQ(0, vcm_->DecodeDualFrame(0));  // Expect no dual decoder action.
 
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Generate NACK list.
 
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 6000 complete.
@@ -299,25 +298,25 @@
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 0.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(3000, 3, true, false, kVideoFrameDelta);
   // Packet 4 missing
   InsertPacket(3000, 5, false, true, kVideoFrameDelta);
   EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(6000, 6, true, false, kVideoFrameDelta);
   InsertPacket(6000, 7, false, false, kVideoFrameDelta);
   InsertPacket(6000, 8, false, true, kVideoFrameDelta);
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 3000 incomplete.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 6000 complete.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(23);
+  clock_->AdvanceTimeMilliseconds(23);
   InsertPacket(3000, 4, false, false, kVideoFrameDelta);
 
   InsertPacket(9000, 9, true, false, kVideoFrameDelta);
@@ -371,14 +370,14 @@
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 0.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(3000, 3, true, false, kVideoFrameDelta);
   // Packet 4 missing
   InsertPacket(3000, 5, false, true, kVideoFrameDelta);
   EXPECT_EQ(VCM_FRAME_NOT_READY, vcm_->Decode(0));
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(33);
+  clock_->AdvanceTimeMilliseconds(33);
   InsertPacket(6000, 6, true, false, kVideoFrameDelta);
   InsertPacket(6000, 7, false, false, kVideoFrameDelta);
   InsertPacket(6000, 8, false, true, kVideoFrameDelta);
@@ -386,11 +385,12 @@
                                        // Schedule key frame request.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(10);
+  clock_->AdvanceTimeMilliseconds(10);
   EXPECT_EQ(VCM_OK, vcm_->Decode(0));  // Decode timestamp 6000 complete.
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect no NACK list.
 
-  clock_->IncrementDebugClock(500);    // Wait for the key request timer to set.
+  // Wait for the key request timer to set.
+  clock_->AdvanceTimeMilliseconds(500);
   EXPECT_EQ(VCM_OK, vcm_->Process());  // Expect key frame request.
 }
 }  // namespace webrtc
diff --git a/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc b/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc
index 628d509..5d1c916 100644
--- a/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc
+++ b/webrtc/modules/video_coding/main/test/decode_from_storage_test.cc
@@ -14,7 +14,7 @@
 #include "trace.h"
 #include "../source/event.h"
 #include "rtp_player.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 using namespace webrtc;
 
@@ -64,7 +64,7 @@
     Trace::SetLevelFilter(webrtc::kTraceAll);
 
 
-    FakeTickTime clock(0);
+    SimulatedClock clock(0);
     // TODO(hlundin): This test was not verified after changing to FakeTickTime.
     VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
     VideoCodingModule* vcmPlayback = VideoCodingModule::Create(2, &clock);
@@ -125,9 +125,9 @@
     ret = 0;
 
     // RTP stream main loop
-    while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
+    while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
     {
-        if (clock.MillisecondTimestamp() % 5 == 0)
+        if (clock.TimeInMilliseconds() % 5 == 0)
         {
             ret = vcm->Decode();
             if (ret < 0)
@@ -139,11 +139,11 @@
         {
             vcm->Process();
         }
-        if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >= MAX_RUNTIME_MS)
+        if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >= MAX_RUNTIME_MS)
         {
             break;
         }
-        clock.IncrementDebugClock(1);
+        clock.AdvanceTimeMilliseconds(1);
     }
 
     switch (ret)
diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.cc b/webrtc/modules/video_coding/main/test/generic_codec_test.cc
index 2220d3e..3f21a65 100644
--- a/webrtc/modules/video_coding/main/test/generic_codec_test.cc
+++ b/webrtc/modules/video_coding/main/test/generic_codec_test.cc
@@ -15,7 +15,7 @@
 #include "rtp_rtcp.h"
 #include "common_video/interface/i420_video_frame.h"
 #include "test_macros.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 using namespace webrtc;
 
@@ -27,7 +27,7 @@
     printf("\n\nEnable debug events to run this test!\n\n");
     return -1;
 #endif
-    FakeTickTime clock(0);
+    SimulatedClock clock(0);
     VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
     GenericCodecTest* get = new GenericCodecTest(vcm, &clock);
     Trace::CreateTrace();
@@ -41,7 +41,8 @@
     return 0;
 }
 
-GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm, FakeTickTime* clock):
+GenericCodecTest::GenericCodecTest(VideoCodingModule* vcm,
+                                   SimulatedClock* clock):
 _clock(clock),
 _vcm(vcm),
 _width(0),
@@ -332,10 +333,6 @@
                 IncrementDebugClock(_frameRate);
                 // The following should be uncommneted for timing tests. Release tests only include
                 // compliance with full sequence bit rate.
-
-
-                //totalBytes = WaitForEncodedFrame();
-                //currentTime = VCMTickTime::MillisecondTimestamp();//clock()/(double)CLOCKS_PER_SEC;
                 if (_frameCnt == _frameRate)// @ 1sec
                 {
                     totalBytesOneSec =  _encodeCompleteCallback->EncodedBytes();//totalBytes;
@@ -482,8 +479,8 @@
 float
 GenericCodecTest::WaitForEncodedFrame() const
 {
-    WebRtc_Word64 startTime = _clock->MillisecondTimestamp();
-    while (_clock->MillisecondTimestamp() - startTime < kMaxWaitEncTimeMs*10)
+    WebRtc_Word64 startTime = _clock->TimeInMilliseconds();
+    while (_clock->TimeInMilliseconds() - startTime < kMaxWaitEncTimeMs*10)
     {
         if (_encodeCompleteCallback->EncodeComplete())
         {
@@ -496,7 +493,7 @@
 void
 GenericCodecTest::IncrementDebugClock(float frameRate)
 {
-    _clock->IncrementDebugClock(1000/frameRate);
+    _clock->AdvanceTimeMilliseconds(1000/frameRate);
 }
 
 int
diff --git a/webrtc/modules/video_coding/main/test/generic_codec_test.h b/webrtc/modules/video_coding/main/test/generic_codec_test.h
index f60893b..f0f46dc 100644
--- a/webrtc/modules/video_coding/main/test/generic_codec_test.h
+++ b/webrtc/modules/video_coding/main/test/generic_codec_test.h
@@ -31,13 +31,13 @@
 
 int VCMGenericCodecTest(CmdArgs& args);
 
-class FakeTickTime;
+class SimulatedClock;
 
 class GenericCodecTest
 {
 public:
     GenericCodecTest(webrtc::VideoCodingModule* vcm,
-                     webrtc::FakeTickTime* clock);
+                     webrtc::SimulatedClock* clock);
     ~GenericCodecTest();
     static int RunTest(CmdArgs& args);
     WebRtc_Word32 Perform(CmdArgs& args);
@@ -49,7 +49,7 @@
     WebRtc_Word32 TearDown();
     void IncrementDebugClock(float frameRate);
 
-    webrtc::FakeTickTime*                _clock;
+    webrtc::SimulatedClock*              _clock;
     webrtc::VideoCodingModule*           _vcm;
     webrtc::VideoCodec                   _sendCodec;
     webrtc::VideoCodec                   _receiveCodec;
diff --git a/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc b/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc
index 99d8ac5..69c4c20 100644
--- a/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc
+++ b/webrtc/modules/video_coding/main/test/jitter_buffer_test.cc
@@ -19,10 +19,10 @@
 #include "jitter_estimate_test.h"
 #include "jitter_estimator.h"
 #include "media_opt_util.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "packet.h"
 #include "test_util.h"
 #include "test_macros.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 // TODO(holmer): Get rid of this to conform with style guide.
 using namespace webrtc;
@@ -97,7 +97,7 @@
 #if defined(EVENT_DEBUG)
     return -1;
 #endif
-    TickTimeBase clock;
+    Clock* clock = Clock::GetRealTimeClock();
 
     // Start test
     WebRtc_UWord16 seqNum = 1234;
@@ -106,7 +106,7 @@
     WebRtc_UWord8 data[1500];
     VCMPacket packet(data, size, seqNum, timeStamp, true);
 
-    VCMJitterBuffer jb(&clock);
+    VCMJitterBuffer jb(clock);
 
     seqNum = 1234;
     timeStamp = 123*90;
diff --git a/webrtc/modules/video_coding/main/test/media_opt_test.cc b/webrtc/modules/video_coding/main/test/media_opt_test.cc
index 8d398d2..12697cf 100644
--- a/webrtc/modules/video_coding/main/test/media_opt_test.cc
+++ b/webrtc/modules/video_coding/main/test/media_opt_test.cc
@@ -32,9 +32,9 @@
     Trace::CreateTrace();
     Trace::SetTraceFile((test::OutputPath() + "mediaOptTestTrace.txt").c_str());
     Trace::SetLevelFilter(webrtc::kTraceAll);
-    TickTimeBase clock;
-    VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
-    MediaOptTest* mot = new MediaOptTest(vcm, &clock);
+    Clock* clock = Clock::GetRealTimeClock();
+    VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
+    MediaOptTest* mot = new MediaOptTest(vcm, clock);
     if (testNum == 0)
     { // regular
          mot->Setup(0, args);
@@ -65,7 +65,7 @@
 }
 
 
-MediaOptTest::MediaOptTest(VideoCodingModule* vcm, TickTimeBase* clock)
+MediaOptTest::MediaOptTest(VideoCodingModule* vcm, Clock* clock)
     : _vcm(vcm),
       _rtp(NULL),
       _outgoingTransport(NULL),
diff --git a/webrtc/modules/video_coding/main/test/media_opt_test.h b/webrtc/modules/video_coding/main/test/media_opt_test.h
index 5f210e6..24f53ab 100644
--- a/webrtc/modules/video_coding/main/test/media_opt_test.h
+++ b/webrtc/modules/video_coding/main/test/media_opt_test.h
@@ -34,7 +34,7 @@
 {
 public:
     MediaOptTest(webrtc::VideoCodingModule* vcm,
-                 webrtc::TickTimeBase* clock);
+                 webrtc::Clock* clock);
     ~MediaOptTest();
 
     static int RunTest(int testNum, CmdArgs& args);
@@ -57,7 +57,7 @@
     webrtc::RTPSendCompleteCallback* _outgoingTransport;
     RtpDataCallback*                 _dataCallback;
 
-    webrtc::TickTimeBase*            _clock;
+    webrtc::Clock*                   _clock;
     std::string                      _inname;
     std::string                      _outname;
     std::string                      _actualSourcename;
diff --git a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
index 6ec9389..b99c31a 100644
--- a/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
+++ b/webrtc/modules/video_coding/main/test/mt_rx_tx_test.cc
@@ -143,12 +143,12 @@
         printf("Cannot read file %s.\n", outname.c_str());
         return -1;
     }
-    TickTimeBase clock;
-    VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
+    Clock* clock = Clock::GetRealTimeClock();
+    VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
     RtpDataCallback dataCallback(vcm);
 
     RTPSendCompleteCallback* outgoingTransport =
-        new RTPSendCompleteCallback(&clock, "dump.rtp");
+        new RTPSendCompleteCallback(clock, "dump.rtp");
 
     RtpRtcp::Configuration configuration;
     configuration.id = 1;
diff --git a/webrtc/modules/video_coding/main/test/mt_test_common.cc b/webrtc/modules/video_coding/main/test/mt_test_common.cc
index ece0d9c..e27f166 100644
--- a/webrtc/modules/video_coding/main/test/mt_test_common.cc
+++ b/webrtc/modules/video_coding/main/test/mt_test_common.cc
@@ -12,12 +12,12 @@
 
 #include <cmath>
 
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "rtp_dump.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
-TransportCallback::TransportCallback(TickTimeBase* clock, const char* filename)
+TransportCallback::TransportCallback(Clock* clock, const char* filename)
     : RTPSendCompleteCallback(clock, filename) {
 }
 
@@ -47,8 +47,8 @@
         transmitPacket = PacketLoss();
     }
 
-    TickTimeBase clock;
-    int64_t now = clock.MillisecondTimestamp();
+    Clock* clock = Clock::GetRealTimeClock();
+    int64_t now = clock->TimeInMilliseconds();
     // Insert outgoing packet into list
     if (transmitPacket)
     {
@@ -72,8 +72,8 @@
 {
     // Are we ready to send packets to the receiver?
     RtpPacket* packet = NULL;
-    TickTimeBase clock;
-    int64_t now = clock.MillisecondTimestamp();
+    Clock* clock = Clock::GetRealTimeClock();
+    int64_t now = clock->TimeInMilliseconds();
 
     while (!_rtpPackets.empty())
     {
diff --git a/webrtc/modules/video_coding/main/test/mt_test_common.h b/webrtc/modules/video_coding/main/test/mt_test_common.h
index c17d269..e1ae0c6 100644
--- a/webrtc/modules/video_coding/main/test/mt_test_common.h
+++ b/webrtc/modules/video_coding/main/test/mt_test_common.h
@@ -47,7 +47,7 @@
 {
  public:
     // constructor input: (receive side) rtp module to send encoded data to
-    TransportCallback(TickTimeBase* clock, const char* filename = NULL);
+    TransportCallback(Clock* clock, const char* filename = NULL);
     virtual ~TransportCallback();
     // Add packets to list
     // Incorporate network conditions - delay and packet loss
diff --git a/webrtc/modules/video_coding/main/test/normal_test.cc b/webrtc/modules/video_coding/main/test/normal_test.cc
index 96e5008..e88ff87 100644
--- a/webrtc/modules/video_coding/main/test/normal_test.cc
+++ b/webrtc/modules/video_coding/main/test/normal_test.cc
@@ -18,12 +18,12 @@
 #include "../source/event.h"
 #include "common_video/libyuv/include/webrtc_libyuv.h"
 #include "common_types.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
 #include "test_callbacks.h"
 #include "test_macros.h"
 #include "test_util.h"
 #include "trace.h"
 #include "testsupport/metrics/video_metrics.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 using namespace webrtc;
 
@@ -31,17 +31,18 @@
 {
 #if defined(EVENT_DEBUG)
     printf("SIMULATION TIME\n");
-    FakeTickTime clock(0);
+    SimulatedClock sim_clock;
+    SimulatedClock* clock = &sim_clock;
 #else
     printf("REAL-TIME\n");
-    TickTimeBase clock;
+    Clock* clock = Clock::GetRealTimeClock();
 #endif
     Trace::CreateTrace();
     Trace::SetTraceFile(
         (test::OutputPath() + "VCMNormalTestTrace.txt").c_str());
     Trace::SetLevelFilter(webrtc::kTraceAll);
-    VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
-    NormalTest VCMNTest(vcm, &clock);
+    VideoCodingModule* vcm = VideoCodingModule::Create(1, clock);
+    NormalTest VCMNTest(vcm, clock);
     VCMNTest.Perform(args);
     VideoCodingModule::Destroy(vcm);
     Trace::ReturnTrace();
@@ -183,7 +184,7 @@
 
  //VCM Normal Test Class implementation
 
-NormalTest::NormalTest(VideoCodingModule* vcm, TickTimeBase* clock)
+NormalTest::NormalTest(VideoCodingModule* vcm, Clock* clock)
 :
 _clock(clock),
 _vcm(vcm),
@@ -289,7 +290,7 @@
 
   while (feof(_sourceFile) == 0) {
 #if !defined(EVENT_DEBUG)
-    WebRtc_Word64 processStartTime = _clock->MillisecondTimestamp();
+    WebRtc_Word64 processStartTime = _clock->TimeInMilliseconds();
 #endif
     TEST(fread(tmpBuffer, 1, _lengthSourceFrame, _sourceFile) > 0 ||
          feof(_sourceFile));
@@ -332,10 +333,10 @@
             1000.0f / static_cast<float>(_sendCodec.maxFramerate) + 0.5f);
 
 #if defined(EVENT_DEBUG)
-    static_cast<FakeTickTime*>(_clock)->IncrementDebugClock(framePeriod);
+    static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(framePeriod);
 #else
     WebRtc_Word64 timeSpent =
-        _clock->MillisecondTimestamp() - processStartTime;
+        _clock->TimeInMilliseconds() - processStartTime;
     if (timeSpent < framePeriod)
     {
       waitEvent->Wait(framePeriod - timeSpent);
diff --git a/webrtc/modules/video_coding/main/test/normal_test.h b/webrtc/modules/video_coding/main/test/normal_test.h
index 0394d6e..14d55a1 100644
--- a/webrtc/modules/video_coding/main/test/normal_test.h
+++ b/webrtc/modules/video_coding/main/test/normal_test.h
@@ -86,7 +86,7 @@
 {
 public:
     NormalTest(webrtc::VideoCodingModule* vcm,
-               webrtc::TickTimeBase* clock);
+               webrtc::Clock* clock);
     ~NormalTest();
     static int RunTest(const CmdArgs& args);
     WebRtc_Word32    Perform(const CmdArgs& args);
@@ -108,7 +108,7 @@
     // calculating pipeline delay, and decoding time
     void            FrameDecoded(WebRtc_UWord32 timeStamp);
 
-    webrtc::TickTimeBase*            _clock;
+    webrtc::Clock*                   _clock;
     webrtc::VideoCodingModule*       _vcm;
     webrtc::VideoCodec               _sendCodec;
     webrtc::VideoCodec               _receiveCodec;
diff --git a/webrtc/modules/video_coding/main/test/quality_modes_test.cc b/webrtc/modules/video_coding/main/test/quality_modes_test.cc
index 57632cc..81f3d9d 100644
--- a/webrtc/modules/video_coding/main/test/quality_modes_test.cc
+++ b/webrtc/modules/video_coding/main/test/quality_modes_test.cc
@@ -17,20 +17,19 @@
 
 #include "common_video/libyuv/include/webrtc_libyuv.h"
 #include "modules/video_coding/main/source/event.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "modules/video_coding/main/test/test_callbacks.h"
 #include "modules/video_coding/main/test/test_macros.h"
 #include "modules/video_coding/main/test/test_util.h"
 #include "system_wrappers/interface/data_log.h"
 #include "system_wrappers/interface/data_log.h"
 #include "testsupport/metrics/video_metrics.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 using namespace webrtc;
 
 int qualityModeTest(const CmdArgs& args)
 {
-  FakeTickTime clock(0);
+  SimulatedClock clock(0);
   VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
   QualityModesTest QMTest(vcm, &clock);
   QMTest.Perform(args);
@@ -39,7 +38,7 @@
 }
 
 QualityModesTest::QualityModesTest(VideoCodingModule* vcm,
-                                   TickTimeBase* clock):
+                                   Clock* clock):
 NormalTest(vcm, clock),
 _vpm()
 {
@@ -367,8 +366,8 @@
       DataLog::InsertCell(feature_table_name_, "frame rate", _nativeFrameRate);
       DataLog::NextRow(feature_table_name_);
 
-      static_cast<FakeTickTime*>(
-          _clock)->IncrementDebugClock(1000 / _nativeFrameRate);
+      static_cast<SimulatedClock*>(_clock)->AdvanceTimeMilliseconds(
+          1000 / _nativeFrameRate);
   }
 
   } while (feof(_sourceFile) == 0);
diff --git a/webrtc/modules/video_coding/main/test/quality_modes_test.h b/webrtc/modules/video_coding/main/test/quality_modes_test.h
index 10f023b..0bb7e09 100644
--- a/webrtc/modules/video_coding/main/test/quality_modes_test.h
+++ b/webrtc/modules/video_coding/main/test/quality_modes_test.h
@@ -22,7 +22,7 @@
 {
 public:
     QualityModesTest(webrtc::VideoCodingModule* vcm,
-                     webrtc::TickTimeBase* clock);
+                     webrtc::Clock* clock);
     virtual ~QualityModesTest();
     WebRtc_Word32 Perform(const CmdArgs& args);
 
diff --git a/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc b/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc
index 0b09256..b273b0e 100644
--- a/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc
+++ b/webrtc/modules/video_coding/main/test/receiver_timing_tests.cc
@@ -61,8 +61,8 @@
     // A static random seed
     srand(0);
 
-    TickTimeBase clock;
-    VCMTiming timing(&clock);
+    Clock* clock = Clock::GetRealTimeClock();
+    VCMTiming timing(clock);
     float clockInMs = 0.0;
     WebRtc_UWord32 waitTime = 0;
     WebRtc_UWord32 jitterDelayMs = 0;
diff --git a/webrtc/modules/video_coding/main/test/rtp_player.cc b/webrtc/modules/video_coding/main/test/rtp_player.cc
index 9eacf34..de06224 100644
--- a/webrtc/modules/video_coding/main/test/rtp_player.cc
+++ b/webrtc/modules/video_coding/main/test/rtp_player.cc
@@ -20,8 +20,8 @@
 
 #include "../source/internal_defines.h"
 #include "gtest/gtest.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "rtp_rtcp.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 using namespace webrtc;
 
@@ -137,7 +137,7 @@
 
 RTPPlayer::RTPPlayer(const char* filename,
                      RtpData* callback,
-                     TickTimeBase* clock)
+                     Clock* clock)
 :
 _clock(clock),
 _rtpModule(NULL),
@@ -273,7 +273,8 @@
 
 WebRtc_UWord32 RTPPlayer::TimeUntilNextPacket() const
 {
-    WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) - (_clock->MillisecondTimestamp() - _firstPacketTimeMs);
+    WebRtc_Word64 timeLeft = (_nextRtpTime - _firstPacketRtpTime) -
+        (_clock->TimeInMilliseconds() - _firstPacketTimeMs);
     if (timeLeft < 0)
     {
         return 0;
@@ -293,7 +294,7 @@
       delete resend_packet;
       _resendPacketCount++;
       if (ret > 0) {
-        _lostPackets.SetPacketResent(seqNo, _clock->MillisecondTimestamp());
+        _lostPackets.SetPacketResent(seqNo, _clock->TimeInMilliseconds());
       } else if (ret < 0) {
         return ret;
       }
@@ -307,7 +308,7 @@
         if (_firstPacket)
         {
             _firstPacketRtpTime = static_cast<WebRtc_Word64>(_nextRtpTime);
-            _firstPacketTimeMs = _clock->MillisecondTimestamp();
+            _firstPacketTimeMs = _clock->TimeInMilliseconds();
         }
         if (_reordering && _reorderBuffer == NULL)
         {
@@ -428,8 +429,8 @@
     for (int i=0; i < length; i++)
     {
         _lostPackets.SetResendTime(sequenceNumbers[i],
-                                   _clock->MillisecondTimestamp() + _rttMs,
-                                   _clock->MillisecondTimestamp());
+                                   _clock->TimeInMilliseconds() + _rttMs,
+                                   _clock->TimeInMilliseconds());
     }
     return 0;
 }
diff --git a/webrtc/modules/video_coding/main/test/rtp_player.h b/webrtc/modules/video_coding/main/test/rtp_player.h
index 9920d0c..d6b0734 100644
--- a/webrtc/modules/video_coding/main/test/rtp_player.h
+++ b/webrtc/modules/video_coding/main/test/rtp_player.h
@@ -15,7 +15,7 @@
 #include "rtp_rtcp.h"
 #include "critical_section_wrapper.h"
 #include "video_coding_defines.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 #include <stdio.h>
 #include <list>
@@ -78,7 +78,7 @@
 public:
     RTPPlayer(const char* filename,
               webrtc::RtpData* callback,
-              webrtc::TickTimeBase* clock);
+              webrtc::Clock* clock);
     virtual ~RTPPlayer();
 
     WebRtc_Word32 Initialize(const PayloadTypeList* payloadList);
@@ -93,7 +93,7 @@
     WebRtc_Word32 SendPacket(WebRtc_UWord8* rtpData, WebRtc_UWord16 rtpLen);
     WebRtc_Word32 ReadPacket(WebRtc_Word16* rtpdata, WebRtc_UWord32* offset);
     WebRtc_Word32 ReadHeader();
-    webrtc::TickTimeBase* _clock;
+    webrtc::Clock*     _clock;
     FILE*              _rtpFile;
     webrtc::RtpRtcp*   _rtpModule;
     WebRtc_UWord32     _nextRtpTime;
diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.cc b/webrtc/modules/video_coding/main/test/test_callbacks.cc
index 12824ba..4d7d3d3 100644
--- a/webrtc/modules/video_coding/main/test/test_callbacks.cc
+++ b/webrtc/modules/video_coding/main/test/test_callbacks.cc
@@ -13,9 +13,9 @@
 #include <cmath>
 
 #include "common_video/libyuv/include/webrtc_libyuv.h"
-#include "modules/video_coding/main/source/tick_time_base.h"
 #include "rtp_dump.h"
 #include "test_macros.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 namespace webrtc {
 
@@ -204,7 +204,7 @@
     return _decodedBytes;
 }
 
-RTPSendCompleteCallback::RTPSendCompleteCallback(TickTimeBase* clock,
+RTPSendCompleteCallback::RTPSendCompleteCallback(Clock* clock,
                                                  const char* filename):
     _clock(clock),
     _sendCount(0),
@@ -258,7 +258,7 @@
     bool transmitPacket = true;
     transmitPacket = PacketLoss();
 
-    WebRtc_UWord64 now = _clock->MillisecondTimestamp();
+    int64_t now = _clock->TimeInMilliseconds();
     // Insert outgoing packet into list
     if (transmitPacket)
     {
diff --git a/webrtc/modules/video_coding/main/test/test_callbacks.h b/webrtc/modules/video_coding/main/test/test_callbacks.h
index f2c419b..01c1b7c 100644
--- a/webrtc/modules/video_coding/main/test/test_callbacks.h
+++ b/webrtc/modules/video_coding/main/test/test_callbacks.h
@@ -157,7 +157,7 @@
 {
 public:
     // Constructor input: (receive side) rtp module to send encoded data to
-    RTPSendCompleteCallback(TickTimeBase* clock,
+    RTPSendCompleteCallback(Clock* clock,
                             const char* filename = NULL);
     virtual ~RTPSendCompleteCallback();
 
@@ -186,7 +186,7 @@
     // Random uniform loss model
     bool UnifomLoss(double lossPct);
 
-    TickTimeBase*           _clock;
+    Clock*                  _clock;
     WebRtc_UWord32          _sendCount;
     RtpRtcp*                _rtp;
     double                  _lossPct;
diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play.cc b/webrtc/modules/video_coding/main/test/video_rtp_play.cc
index 49b7f73..bd22168 100644
--- a/webrtc/modules/video_coding/main/test/video_rtp_play.cc
+++ b/webrtc/modules/video_coding/main/test/video_rtp_play.cc
@@ -17,7 +17,7 @@
 #include "../source/internal_defines.h"
 #include "test_macros.h"
 #include "rtp_player.h"
-#include "modules/video_coding/main/source/mock/fake_tick_time.h"
+#include "webrtc/system_wrappers/interface/clock.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -130,7 +130,7 @@
     if (outFile == "")
         outFile = test::OutputPath() + "RtpPlay_decoded.yuv";
     FrameReceiveCallback receiveCallback(outFile);
-    FakeTickTime clock(0);
+    SimulatedClock clock(0);
     VideoCodingModule* vcm = VideoCodingModule::Create(1, &clock);
     RtpDataCallback dataCallback(vcm);
     RTPPlayer rtpStream(args.inputFile.c_str(), &dataCallback, &clock);
@@ -198,9 +198,9 @@
     ret = 0;
 
     // RTP stream main loop
-    while ((ret = rtpStream.NextPacket(clock.MillisecondTimestamp())) == 0)
+    while ((ret = rtpStream.NextPacket(clock.TimeInMilliseconds())) == 0)
     {
-        if (clock.MillisecondTimestamp() % 5 == 0)
+        if (clock.TimeInMilliseconds() % 5 == 0)
         {
             ret = vcm->Decode();
             if (ret < 0)
@@ -214,12 +214,12 @@
         {
             vcm->Process();
         }
-        if (MAX_RUNTIME_MS > -1 && clock.MillisecondTimestamp() >=
+        if (MAX_RUNTIME_MS > -1 && clock.TimeInMilliseconds() >=
             MAX_RUNTIME_MS)
         {
             break;
         }
-        clock.IncrementDebugClock(1);
+        clock.AdvanceTimeMilliseconds(1);
     }
 
     // Tear down
diff --git a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc
index ecb7ab6..911eb5c 100644
--- a/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc
+++ b/webrtc/modules/video_coding/main/test/video_rtp_play_mt.cc
@@ -8,17 +8,18 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "receiver_tests.h"
-#include "video_coding.h"
-#include "rtp_rtcp.h"
-#include "trace.h"
-#include "thread_wrapper.h"
-#include "../source/event.h"
-#include "test_macros.h"
-#include "rtp_player.h"
-
 #include <string.h>
 
+#include "webrtc/modules/rtp_rtcp/interface/rtp_rtcp.h"
+#include "webrtc/modules/video_coding/main/interface/video_coding.h"
+#include "webrtc/modules/video_coding/main/source/event.h"
+#include "webrtc/modules/video_coding/main/test/receiver_tests.h"
+#include "webrtc/modules/video_coding/main/test/rtp_player.h"
+#include "webrtc/modules/video_coding/main/test/test_macros.h"
+#include "webrtc/system_wrappers/interface/clock.h"
+#include "webrtc/system_wrappers/interface/thread_wrapper.h"
+#include "webrtc/system_wrappers/interface/trace.h"
+
 using namespace webrtc;
 
 bool ProcessingThread(void* obj)
@@ -39,8 +40,8 @@
     SharedState* state = static_cast<SharedState*>(obj);
     EventWrapper& waitEvent = *EventWrapper::Create();
     // RTP stream main loop
-    TickTimeBase clock;
-    if (state->_rtpPlayer.NextPacket(clock.MillisecondTimestamp()) < 0)
+    Clock* clock = Clock::GetRealTimeClock();
+    if (state->_rtpPlayer.NextPacket(clock->TimeInMilliseconds()) < 0)
     {
         return false;
     }
@@ -82,9 +83,9 @@
                 (protection == kProtectionDualDecoder ||
                 protection == kProtectionNack ||
                 kProtectionNackFEC));
-    TickTimeBase clock;
+    Clock* clock = Clock::GetRealTimeClock();
     VideoCodingModule* vcm =
-            VideoCodingModule::Create(1, &clock);
+            VideoCodingModule::Create(1, clock);
     RtpDataCallback dataCallback(vcm);
     std::string rtpFilename;
     rtpFilename = args.inputFile;
@@ -137,7 +138,7 @@
         }
         printf("Watch %s to verify that the output is reasonable\n", outFilename.c_str());
     }
-    RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, &clock);
+    RTPPlayer rtpStream(rtpFilename.c_str(), &dataCallback, clock);
     PayloadTypeList payloadTypes;
     payloadTypes.push_front(new PayloadCodecTuple(VCM_VP8_PAYLOAD_TYPE, "VP8",
                                                   kVideoCodecVP8));
@@ -164,10 +165,10 @@
     }
 
     // Create and start all threads
-    ThreadWrapper* processingThread = ThreadWrapper::CreateThread(ProcessingThread,
-            &mtState, kNormalPriority, "ProcessingThread");
-    ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(RtpReaderThread,
-            &mtState, kNormalPriority, "RtpReaderThread");
+    ThreadWrapper* processingThread = ThreadWrapper::CreateThread(
+        ProcessingThread, &mtState, kNormalPriority, "ProcessingThread");
+    ThreadWrapper* rtpReaderThread = ThreadWrapper::CreateThread(
+        RtpReaderThread, &mtState, kNormalPriority, "RtpReaderThread");
     ThreadWrapper* decodeThread = ThreadWrapper::CreateThread(DecodeThread,
             &mtState, kNormalPriority, "DecodeThread");