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/rtp_rtcp/source/bitrate.cc b/webrtc/modules/rtp_rtcp/source/bitrate.cc
index 8f1bac8..69601d2 100644
--- a/webrtc/modules/rtp_rtcp/source/bitrate.cc
+++ b/webrtc/modules/rtp_rtcp/source/bitrate.cc
@@ -15,7 +15,7 @@
 namespace webrtc {
 
 Bitrate::Bitrate(Clock* clock)
-    : clock_(*clock),
+    : clock_(clock),
       packet_rate_(0),
       bitrate_(0),
       bitrate_next_idx_(0),
@@ -41,7 +41,7 @@
 }
 
 WebRtc_UWord32 Bitrate::BitrateNow() const {
-  WebRtc_Word64 now = clock_.TimeInMilliseconds();
+  WebRtc_Word64 now = clock_->TimeInMilliseconds();
   WebRtc_Word64 diff_ms = now - time_last_rate_update_;
 
   if (diff_ms > 10000) {  // 10 seconds.
@@ -59,7 +59,7 @@
 
 void Bitrate::Process() {
   // Triggered by timer.
-  WebRtc_Word64 now = clock_.TimeInMilliseconds();
+  WebRtc_Word64 now = clock_->TimeInMilliseconds();
   WebRtc_Word64 diff_ms = now - time_last_rate_update_;
 
   if (diff_ms < 100) {
diff --git a/webrtc/modules/rtp_rtcp/source/bitrate.h b/webrtc/modules/rtp_rtcp/source/bitrate.h
index d8c8aa8..9a0217f 100644
--- a/webrtc/modules/rtp_rtcp/source/bitrate.h
+++ b/webrtc/modules/rtp_rtcp/source/bitrate.h
@@ -42,7 +42,7 @@
   WebRtc_UWord32 BitrateNow() const;
 
  protected:
-  Clock& clock_;
+  Clock* clock_;
 
  private:
   WebRtc_UWord32 packet_rate_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
index 03ca64e..0438510 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_format_remb_unittest.cc
@@ -99,7 +99,6 @@
   delete rtcp_receiver_;
   delete dummy_rtp_rtcp_impl_;
   delete test_transport_;
-  delete system_clock_;
 }
 
 TEST_F(RtcpFormatRembTest, TestBasicAPI) {
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
index 7bf20ee..e300439 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.cc
@@ -34,7 +34,7 @@
                            ModuleRtpRtcpImpl* owner)
     : TMMBRHelp(),
     _id(id),
-    _clock(*clock),
+    _clock(clock),
     _method(kRtcpOff),
     _lastReceived(0),
     _rtpRtcp(*owner),
@@ -285,7 +285,7 @@
 {
     CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
 
-    _lastReceived = _clock.TimeInMilliseconds();
+    _lastReceived = _clock->TimeInMilliseconds();
 
     RTCPUtility::RTCPPacketTypes pktType = rtcpParser->Begin();
     while (pktType != RTCPUtility::kRtcpNotValidCode)
@@ -406,7 +406,7 @@
             _remoteSenderInfo.sendPacketCount = rtcpPacket.SR.SenderPacketCount;
             _remoteSenderInfo.sendOctetCount = rtcpPacket.SR.SenderOctetCount;
 
-            _clock.CurrentNtp(_lastReceivedSRNTPsecs, _lastReceivedSRNTPfrac);
+            _clock->CurrentNtp(_lastReceivedSRNTPsecs, _lastReceivedSRNTPfrac);
         }
         else
         {
@@ -466,7 +466,7 @@
     return;
   }
 
-  _lastReceivedRrMs = _clock.TimeInMilliseconds();
+  _lastReceivedRrMs = _clock->TimeInMilliseconds();
   const RTCPPacketReportBlockItem& rb = rtcpPacket.ReportBlockItem;
   reportBlock->remoteReceiveBlock.remoteSSRC = remoteSSRC;
   reportBlock->remoteReceiveBlock.sourceSSRC = rb.SSRC;
@@ -496,7 +496,7 @@
   WebRtc_UWord32 lastReceivedRRNTPsecs = 0;
   WebRtc_UWord32 lastReceivedRRNTPfrac = 0;
 
-  _clock.CurrentNtp(lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
+  _clock->CurrentNtp(lastReceivedRRNTPsecs, lastReceivedRRNTPfrac);
 
   // time when we received this in MS
   WebRtc_UWord32 receiveTimeMS = ModuleRTPUtility::ConvertNTPTimeToMS(
@@ -641,7 +641,7 @@
 void RTCPReceiver::UpdateReceiveInformation(
     RTCPReceiveInformation& receiveInformation) {
   // Update that this remote is alive
-  receiveInformation.lastTimeReceived = _clock.TimeInMilliseconds();
+  receiveInformation.lastTimeReceived = _clock->TimeInMilliseconds();
 }
 
 bool RTCPReceiver::RtcpRrTimeout(int64_t rtcp_interval_ms) {
@@ -650,7 +650,7 @@
     return false;
 
   int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
-  if (_clock.TimeInMilliseconds() > _lastReceivedRrMs + time_out_ms) {
+  if (_clock->TimeInMilliseconds() > _lastReceivedRrMs + time_out_ms) {
     // Reset the timer to only trigger one log.
     _lastReceivedRrMs = 0;
     return true;
@@ -664,7 +664,7 @@
     return false;
 
   int64_t time_out_ms = kRrTimeoutIntervals * rtcp_interval_ms;
-  if (_clock.TimeInMilliseconds() > _lastIncreasedSequenceNumberMs +
+  if (_clock->TimeInMilliseconds() > _lastIncreasedSequenceNumberMs +
       time_out_ms) {
     // Reset the timer to only trigger one log.
     _lastIncreasedSequenceNumberMs = 0;
@@ -677,7 +677,7 @@
   CriticalSectionScoped lock(_criticalSectionRTCPReceiver);
 
   bool updateBoundingSet = false;
-  WebRtc_Word64 timeNow = _clock.TimeInMilliseconds();
+  WebRtc_Word64 timeNow = _clock->TimeInMilliseconds();
 
   std::map<WebRtc_UWord32, RTCPReceiveInformation*>::iterator receiveInfoIt =
       _receivedInfoMap.begin();
@@ -962,7 +962,7 @@
         rtcpPacket.TMMBRItem.MaxTotalMediaBitRate > 0)
     {
         receiveInfo.InsertTMMBRItem(senderSSRC, rtcpPacket.TMMBRItem,
-                                    _clock.TimeInMilliseconds());
+                                    _clock->TimeInMilliseconds());
         rtcpPacketInformation.rtcpPacketTypeFlags |= kRtcpTmmbr;
     }
 }
@@ -1150,7 +1150,7 @@
     // check if we have reported this FIRSequenceNumber before
     if (rtcpPacket.FIRItem.CommandSequenceNumber !=
         receiveInfo->lastFIRSequenceNumber) {
-      WebRtc_Word64 now = _clock.TimeInMilliseconds();
+      WebRtc_Word64 now = _clock->TimeInMilliseconds();
       // sanity; don't go crazy with the callbacks
       if ((now - receiveInfo->lastFIRRequest) > RTCP_MIN_FRAME_LENGTH_MS) {
         receiveInfo->lastFIRRequest = now;
@@ -1308,7 +1308,7 @@
       if ((rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpSr ||
           rtcpPacketInformation.rtcpPacketTypeFlags & kRtcpRr) &&
           rtcpPacketInformation.reportBlock) {
-        WebRtc_Word64 now = _clock.TimeInMilliseconds();
+        WebRtc_Word64 now = _clock->TimeInMilliseconds();
         _cbRtcpBandwidthObserver->OnReceivedRtcpReceiverReport(
             rtcpPacketInformation.remoteSSRC,
             rtcpPacketInformation.fractionLost,
@@ -1378,7 +1378,7 @@
       for (WebRtc_UWord32 i = 0;
            (num < size) && (i < receiveInfo->TmmbrSet.lengthOfSet()); i++) {
         if (receiveInfo->GetTMMBRSet(i, num, candidateSet,
-                                     _clock.TimeInMilliseconds()) == 0) {
+                                     _clock->TimeInMilliseconds()) == 0) {
           num++;
         }
       }
@@ -1425,7 +1425,7 @@
             return;
         }
 
-        WebRtc_Word64 now = _clock.TimeInMilliseconds();
+        WebRtc_Word64 now = _clock->TimeInMilliseconds();
         if(now - _lastReceived > _packetTimeOutMS)
         {
             packetTimeOut = true;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
index 01a036f..08ff37b 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver.h
@@ -198,7 +198,7 @@
 
  private:
   WebRtc_Word32           _id;
-  Clock&           _clock;
+  Clock*                  _clock;
   RTCPMethod              _method;
   WebRtc_Word64           _lastReceived;
   ModuleRtpRtcpImpl&      _rtpRtcp;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
index b14db10..783b13a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_receiver_unittest.cc
@@ -168,30 +168,29 @@
  protected:
   RtcpReceiverTest()
       : over_use_detector_options_(),
+        system_clock_(1335900000),
         remote_bitrate_observer_(),
         remote_bitrate_estimator_(
             RemoteBitrateEstimator::Create(
                 &remote_bitrate_observer_,
                 over_use_detector_options_,
                 RemoteBitrateEstimator::kMultiStreamEstimation)) {
-    system_clock_ = new SimulatedClock(1335900000);
     test_transport_ = new TestTransport();
 
     RtpRtcp::Configuration configuration;
     configuration.id = 0;
     configuration.audio = false;
-    configuration.clock = system_clock_;
+    configuration.clock = &system_clock_;
     configuration.outgoing_transport = test_transport_;
     configuration.remote_bitrate_estimator = remote_bitrate_estimator_.get();
     rtp_rtcp_impl_ = new ModuleRtpRtcpImpl(configuration);
-    rtcp_receiver_ = new RTCPReceiver(0, system_clock_, rtp_rtcp_impl_);
+    rtcp_receiver_ = new RTCPReceiver(0, &system_clock_, rtp_rtcp_impl_);
     test_transport_->SetRTCPReceiver(rtcp_receiver_);
   }
   ~RtcpReceiverTest() {
     delete rtcp_receiver_;
     delete rtp_rtcp_impl_;
     delete test_transport_;
-    delete system_clock_;
   }
 
   // Injects an RTCP packet into the receiver.
@@ -210,7 +209,7 @@
   }
 
   OverUseDetectorOptions over_use_detector_options_;
-  SimulatedClock* system_clock_;
+  SimulatedClock system_clock_;
   ModuleRtpRtcpImpl* rtp_rtcp_impl_;
   RTCPReceiver* rtcp_receiver_;
   TestTransport* test_transport_;
@@ -246,7 +245,7 @@
   rtcp_receiver_->SetSSRC(kSourceSsrc);
 
   uint32_t sequence_number = 1234;
-  system_clock_->AdvanceTimeMs(3 * kRtcpIntervalMs);
+  system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs);
 
   // No RR received, shouldn't trigger a timeout.
   EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
@@ -256,7 +255,7 @@
   PacketBuilder p1;
   p1.AddRrPacket(kSenderSsrc, kSourceSsrc, sequence_number);
   EXPECT_EQ(0, InjectRtcpPacket(p1.packet(), p1.length()));
-  system_clock_->AdvanceTimeMs(3 * kRtcpIntervalMs - 1);
+  system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs - 1);
   EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
   EXPECT_FALSE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
 
@@ -265,12 +264,12 @@
   PacketBuilder p2;
   p2.AddRrPacket(kSenderSsrc, kSourceSsrc, sequence_number);
   EXPECT_EQ(0, InjectRtcpPacket(p2.packet(), p2.length()));
-  system_clock_->AdvanceTimeMs(2);
+  system_clock_.AdvanceTimeMilliseconds(2);
   EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
   EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
 
   // Advance clock enough to trigger an RR timeout too.
-  system_clock_->AdvanceTimeMs(3 * kRtcpIntervalMs);
+  system_clock_.AdvanceTimeMilliseconds(3 * kRtcpIntervalMs);
   EXPECT_TRUE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
 
   // We should only get one timeout even though we still haven't received a new
@@ -287,14 +286,14 @@
   EXPECT_FALSE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
 
   // Verify we can get a timeout again once we've received new RR.
-  system_clock_->AdvanceTimeMs(2 * kRtcpIntervalMs);
+  system_clock_.AdvanceTimeMilliseconds(2 * kRtcpIntervalMs);
   PacketBuilder p4;
   p4.AddRrPacket(kSenderSsrc, kSourceSsrc, sequence_number);
   EXPECT_EQ(0, InjectRtcpPacket(p4.packet(), p4.length()));
-  system_clock_->AdvanceTimeMs(kRtcpIntervalMs + 1);
+  system_clock_.AdvanceTimeMilliseconds(kRtcpIntervalMs + 1);
   EXPECT_FALSE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
   EXPECT_TRUE(rtcp_receiver_->RtcpRrSequenceNumberTimeout(kRtcpIntervalMs));
-  system_clock_->AdvanceTimeMs(2 * kRtcpIntervalMs);
+  system_clock_.AdvanceTimeMilliseconds(2 * kRtcpIntervalMs);
   EXPECT_TRUE(rtcp_receiver_->RtcpRrTimeout(kRtcpIntervalMs));
 }
 
@@ -386,7 +385,8 @@
     p.AddTmmbrBandwidth(30000, 0, 0);  // 30 Kbits/sec bandwidth, no overhead.
 
     EXPECT_EQ(0, InjectRtcpPacket(p.packet(), p.length()));
-    system_clock_->AdvanceTimeMs(5000);  // 5 seconds between each packet.
+    // 5 seconds between each packet.
+    system_clock_.AdvanceTimeMilliseconds(5000);
   }
   // It is now starttime+15.
   EXPECT_EQ(3, rtcp_receiver_->TMMBRReceived(0, 0, NULL));
@@ -396,7 +396,7 @@
   EXPECT_LT(0U, candidate_set.Tmmbr(0));
   // We expect the timeout to be 25 seconds. Advance the clock by 12
   // seconds, timing out the first packet.
-  system_clock_->AdvanceTimeMs(12000);
+  system_clock_.AdvanceTimeMilliseconds(12000);
   // Odd behaviour: Just counting them does not trigger the timeout.
   EXPECT_EQ(3, rtcp_receiver_->TMMBRReceived(0, 0, NULL));
   // Odd behaviour: There's only one left after timeout, not 2.
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
index 8611769..d5dd4a1 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.cc
@@ -29,7 +29,7 @@
                        ModuleRtpRtcpImpl* owner) :
     _id(id),
     _audio(audio),
-    _clock(*clock),
+    _clock(clock),
     _method(kRtcpOff),
     _rtpRtcp(*owner),
     _criticalSectionTransport(CriticalSectionWrapper::CreateCriticalSection()),
@@ -183,11 +183,11 @@
     {
         if(_audio)
         {
-            _nextTimeToSendRTCP = _clock.TimeInMilliseconds() +
+            _nextTimeToSendRTCP = _clock->TimeInMilliseconds() +
                 (RTCP_INTERVAL_AUDIO_MS/2);
         } else
         {
-            _nextTimeToSendRTCP = _clock.TimeInMilliseconds() +
+            _nextTimeToSendRTCP = _clock->TimeInMilliseconds() +
                 (RTCP_INTERVAL_VIDEO_MS/2);
         }
     }
@@ -304,7 +304,7 @@
   last_rtp_timestamp_ = rtp_timestamp;
   if (capture_time_ms < 0) {
     // We don't currently get a capture time from VoiceEngine.
-    last_frame_capture_time_ms_ = _clock.TimeInMilliseconds();
+    last_frame_capture_time_ms_ = _clock->TimeInMilliseconds();
   } else {
     last_frame_capture_time_ms_ = capture_time_ms;
   }
@@ -320,7 +320,7 @@
         // not first SetSSRC, probably due to a collision
         // schedule a new RTCP report
         // make sure that we send a RTP packet
-        _nextTimeToSendRTCP = _clock.TimeInMilliseconds() + 100;
+        _nextTimeToSendRTCP = _clock->TimeInMilliseconds() + 100;
     }
     _SSRC = ssrc;
 }
@@ -451,7 +451,7 @@
       a value of the RTCP bandwidth below the intended average
 */
 
-    WebRtc_Word64 now = _clock.TimeInMilliseconds();
+    WebRtc_Word64 now = _clock->TimeInMilliseconds();
 
     CriticalSectionScoped lock(_criticalSectionRTCPSender);
 
@@ -590,7 +590,7 @@
     // timestamp as the last frame's timestamp + the time since the last frame
     // was captured.
     RTPtime = start_timestamp_ + last_rtp_timestamp_ + (
-        _clock.TimeInMilliseconds() - last_frame_capture_time_ms_) *
+        _clock->TimeInMilliseconds() - last_frame_capture_time_ms_) *
             (freqHz / 1000);
 
     // Add sender data
@@ -1580,7 +1580,7 @@
                                          remoteSR);
 
                 // get our NTP as late as possible to avoid a race
-                _clock.CurrentNtp(NTPsec, NTPfrac);
+                _clock->CurrentNtp(NTPsec, NTPfrac);
 
                 // Delay since last received report
                 WebRtc_UWord32 delaySinceLastReceivedSR = 0;
@@ -1602,7 +1602,7 @@
             } else
             {
                 // we need to send our NTP even if we dont have received any reports
-                _clock.CurrentNtp(NTPsec, NTPfrac);
+                _clock->CurrentNtp(NTPsec, NTPfrac);
             }
         }
 
@@ -1697,7 +1697,7 @@
                 }
                 timeToNext = (minIntervalMs/2) + (minIntervalMs*random/1000);
             }
-            _nextTimeToSendRTCP = _clock.TimeInMilliseconds() + timeToNext;
+            _nextTimeToSendRTCP = _clock->TimeInMilliseconds() + timeToNext;
         }
 
         // if the data does not fitt in the packet we fill it as much as possible
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h
index f76b36c..2844975 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender.h
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender.h
@@ -186,7 +186,7 @@
 private:
     WebRtc_Word32            _id;
     const bool               _audio;
-    Clock&                   _clock;
+    Clock*                   _clock;
     RTCPMethod               _method;
 
     ModuleRtpRtcpImpl&      _rtpRtcp;
diff --git a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
index 7cbba88..7bd2931 100644
--- a/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtcp_sender_unittest.cc
@@ -129,7 +129,6 @@
     delete rtcp_receiver_;
     delete rtp_rtcp_impl_;
     delete test_transport_;
-    delete system_clock_;
   }
 
   // Helper function: Incoming RTCP has a specific packet type.
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
index e6577a6..b5de84a 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.cc
@@ -20,7 +20,7 @@
 namespace webrtc {
 
 RTPPacketHistory::RTPPacketHistory(Clock* clock)
-  : clock_(*clock),
+  : clock_(clock),
     critsect_(CriticalSectionWrapper::CreateCriticalSection()),
     store_(false),
     prev_index_(0),
@@ -140,7 +140,7 @@
   stored_seq_nums_[prev_index_] = seq_num;
   stored_lengths_[prev_index_] = packet_length;
   stored_times_[prev_index_] =
-      (capture_time_ms > 0) ? capture_time_ms : clock_.TimeInMilliseconds();
+      (capture_time_ms > 0) ? capture_time_ms : clock_->TimeInMilliseconds();
   stored_resend_times_[prev_index_] = 0;  // packet not resent
   stored_types_[prev_index_] = type;
 
@@ -244,7 +244,7 @@
  }
 
   // Verify elapsed time since last retrieve. 
-  int64_t now = clock_.TimeInMilliseconds();
+  int64_t now = clock_->TimeInMilliseconds();
   if (min_elapsed_time_ms > 0 &&
       ((now - stored_resend_times_.at(index)) < min_elapsed_time_ms)) {
     WEBRTC_TRACE(kTraceStream, kTraceRtpRtcp, -1, 
@@ -276,7 +276,7 @@
         "Failed to update resend time, seq num: %u.", sequence_number);
     return;
   }
-  stored_resend_times_[index] = clock_.TimeInMilliseconds();
+  stored_resend_times_[index] = clock_->TimeInMilliseconds();
 }
 
 // private, lock should already be taken
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
index 59e27fc..cc0a0c8 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history.h
@@ -77,7 +77,7 @@
   bool FindSeqNum(uint16_t sequence_number, int32_t* index) const;
 
  private:
-  Clock& clock_;
+  Clock* clock_;
   CriticalSectionWrapper* critsect_;
   bool store_;
   uint32_t prev_index_;
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
index d90fff9..095606d 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_history_unittest.cc
@@ -12,49 +12,24 @@
 
 #include <gtest/gtest.h>
 
+#include "clock.h"
 #include "rtp_packet_history.h"
 #include "rtp_rtcp_defines.h"
 #include "typedefs.h"
 
 namespace webrtc {
 
-class FakeClock : public Clock {
- public:
-  FakeClock() {
-    time_in_ms_ = 123456;
-  }
-  // Return a timestamp in milliseconds relative to some arbitrary
-  // source; the source is fixed for this clock.
-  virtual WebRtc_Word64 TimeInMilliseconds() {
-    return time_in_ms_;
-  }
-
-  virtual WebRtc_Word64 TimeInMicroseconds() {
-    return time_in_ms_ * 1000;
-  }
-
-  // Retrieve an NTP absolute timestamp.
-  virtual void CurrentNtp(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
-    secs = time_in_ms_ / 1000;
-    frac = (time_in_ms_ % 1000) * 4294967;
-  }
-  void IncrementTime(WebRtc_UWord32 time_increment_ms) {
-    time_in_ms_ += time_increment_ms;
-  }
- private:
-  WebRtc_Word64 time_in_ms_;
-};
-
 class RtpPacketHistoryTest : public ::testing::Test {
  protected:
   RtpPacketHistoryTest()
-     : hist_(new RTPPacketHistory(&fake_clock_)) {
+     : fake_clock_(123456),
+       hist_(new RTPPacketHistory(&fake_clock_)) {
   }
   ~RtpPacketHistoryTest() {
     delete hist_;
   }
   
-  FakeClock fake_clock_;
+  SimulatedClock fake_clock_;
   RTPPacketHistory* hist_;
   enum {kPayload = 127};
   enum {kSsrc = 12345678};
@@ -224,7 +199,7 @@
 TEST_F(RtpPacketHistoryTest, NoCaptureTime) {
   hist_->SetStorePacketsStatus(true, 10);
   uint16_t len = 0;
-  fake_clock_.IncrementTime(1);
+  fake_clock_.AdvanceTimeMilliseconds(1);
   int64_t capture_time_ms = fake_clock_.TimeInMilliseconds();
   CreateRtpPacket(kSeqNum, kSsrc, kPayload, kTimestamp, packet_, &len);
   EXPECT_EQ(0, hist_->PutRTPPacket(packet_, len, kMaxPacketLength,
@@ -270,7 +245,7 @@
                                    capture_time_ms, kAllowRetransmission));
 
   hist_->UpdateResendTime(kSeqNum);
-  fake_clock_.IncrementTime(100);
+  fake_clock_.AdvanceTimeMilliseconds(100);
 
   // Time has elapsed.
   len = kMaxPacketLength;
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_receiver.cc b/webrtc/modules/rtp_rtcp/source/rtp_receiver.cc
index 8132af1..bff6def 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_receiver.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_receiver.cc
@@ -171,7 +171,7 @@
       return;
     }
 
-    WebRtc_Word64 now = clock_.TimeInMilliseconds();
+    WebRtc_Word64 now = clock_->TimeInMilliseconds();
 
     if (now - last_receive_time_ > packet_timeout_ms_) {
       packet_time_out = true;
@@ -416,7 +416,7 @@
 
   WebRtc_Word32 ret_val = rtp_media_receiver_->ParseRtpPacket(
       rtp_header, specific_payload, is_red, packet, packet_length,
-      clock_.TimeInMilliseconds(), is_first_packet);
+      clock_->TimeInMilliseconds(), is_first_packet);
 
   if (ret_val < 0) {
     return ret_val;
@@ -434,13 +434,13 @@
 
   // Need to be updated after RetransmitOfOldPacket and
   // RetransmitOfOldPacketUpdateStatistics.
-  last_receive_time_ = clock_.TimeInMilliseconds();
+  last_receive_time_ = clock_->TimeInMilliseconds();
   last_received_payload_length_ = payload_data_length;
 
   if (!old_packet) {
     if (last_received_timestamp_ != rtp_header->header.timestamp) {
       last_received_timestamp_ = rtp_header->header.timestamp;
-      last_received_frame_time_ms_ = clock_.TimeInMilliseconds();
+      last_received_frame_time_ms_ = clock_->TimeInMilliseconds();
     }
     last_received_sequence_number_ = rtp_header->header.sequenceNumber;
     last_received_transmission_time_offset_ =
@@ -466,14 +466,14 @@
     received_seq_max_ = rtp_header->header.sequenceNumber;
     received_inorder_packet_count_ = 1;
     local_time_last_received_timestamp_ =
-      GetCurrentRTP(&clock_, frequency_hz);  // Time in samples.
+      GetCurrentRTP(clock_, frequency_hz);  // Time in samples.
     return;
   }
 
   // Count only the new packets received.
   if (InOrderPacket(rtp_header->header.sequenceNumber)) {
     const WebRtc_UWord32 RTPtime =
-      GetCurrentRTP(&clock_, frequency_hz);  // Time in samples.
+      GetCurrentRTP(clock_, frequency_hz);  // Time in samples.
     received_inorder_packet_count_++;
 
     // Wrong if we use RetransmitOfOldPacket.
@@ -548,7 +548,8 @@
   }
 
   WebRtc_UWord32 frequency_khz = rtp_media_receiver_->GetFrequencyHz() / 1000;
-  WebRtc_Word64 time_diff_ms = clock_.TimeInMilliseconds() - last_receive_time_;
+  WebRtc_Word64 time_diff_ms = clock_->TimeInMilliseconds() -
+      last_receive_time_;
 
   // Diff in time stamp since last received in order.
   WebRtc_Word32 rtp_time_stamp_diff_ms =
@@ -642,7 +643,7 @@
     return -1;
   }
   // Time in samples.
-  WebRtc_UWord32 diff = GetCurrentRTP(&clock_, frequency_hz) -
+  WebRtc_UWord32 diff = GetCurrentRTP(clock_, frequency_hz) -
                         local_time_last_received_timestamp_;
 
   timestamp = last_received_timestamp_ + diff;
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
index 634010e..40f2432 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.cc
@@ -83,7 +83,6 @@
     configuration_copy.clock = Clock::GetRealTimeClock();
     ModuleRtpRtcpImpl* rtp_rtcp_instance =
         new ModuleRtpRtcpImpl(configuration_copy);
-    rtp_rtcp_instance->OwnsClock();
     return rtp_rtcp_instance;
   }
 }
@@ -102,8 +101,7 @@
       rtcp_sender_(configuration.id, configuration.audio, configuration.clock,
                    this),
       rtcp_receiver_(configuration.id, configuration.clock, this),
-      owns_clock_(false),
-      clock_(*configuration.clock),
+      clock_(configuration.clock),
       id_(configuration.id),
       audio_(configuration.audio),
       collision_detected_(false),
@@ -168,9 +166,6 @@
     plot1_ = NULL;
   }
 #endif
-  if (owns_clock_) {
-    delete &clock_;
-  }
 }
 
 void ModuleRtpRtcpImpl::RegisterChildModule(RtpRtcp* module) {
@@ -217,13 +212,13 @@
 // Returns the number of milliseconds until the module want a worker thread
 // to call Process.
 WebRtc_Word32 ModuleRtpRtcpImpl::TimeUntilNextProcess() {
-    const WebRtc_Word64 now = clock_.TimeInMilliseconds();
+    const WebRtc_Word64 now = clock_->TimeInMilliseconds();
   return kRtpRtcpMaxIdleTimeProcess - (now - last_process_time_);
 }
 
 // Process any pending tasks such as timeouts (non time critical events).
 WebRtc_Word32 ModuleRtpRtcpImpl::Process() {
-    const WebRtc_Word64 now = clock_.TimeInMilliseconds();
+    const WebRtc_Word64 now = clock_->TimeInMilliseconds();
   last_process_time_ = now;
 
   if (now >=
@@ -305,7 +300,7 @@
 
 void ModuleRtpRtcpImpl::ProcessDeadOrAliveTimer() {
   if (dead_or_alive_active_) {
-    const WebRtc_Word64 now = clock_.TimeInMilliseconds();
+    const WebRtc_Word64 now = clock_->TimeInMilliseconds();
     if (now > dead_or_alive_timeout_ms_ + dead_or_alive_last_timer_) {
       // RTCP is alive if we have received a report the last 12 seconds.
       dead_or_alive_last_timer_ += dead_or_alive_timeout_ms_;
@@ -340,7 +335,7 @@
   dead_or_alive_active_ = enable;
   dead_or_alive_timeout_ms_ = sample_time_seconds * 1000;
   // Trigger the first after one period.
-  dead_or_alive_last_timer_ = clock_.TimeInMilliseconds();
+  dead_or_alive_last_timer_ = clock_->TimeInMilliseconds();
   return 0;
 }
 
@@ -1304,7 +1299,7 @@
 #ifdef MATLAB
   if (plot1_ == NULL) {
     plot1_ = eng.NewPlot(new MatlabPlot());
-    plot1_->AddTimeLine(30, "b", "lost", clock_.GetTimeInMS());
+    plot1_->AddTimeLine(30, "b", "lost", clock_->TimeInMilliseconds());
   }
   plot1_->Append("lost", missing);
   plot1_->Plot();
@@ -1520,7 +1515,7 @@
   if (wait_time == 5) {
     wait_time = 100;  // During startup we don't have an RTT.
   }
-  const WebRtc_Word64 now = clock_.TimeInMilliseconds();
+  const WebRtc_Word64 now = clock_->TimeInMilliseconds();
   const WebRtc_Word64 time_limit = now - wait_time;
   WebRtc_UWord16 nackLength = size;
   WebRtc_UWord16 start_id = 0;
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
index cd675bf..2daba1d 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_rtcp_impl.h
@@ -454,12 +454,6 @@
 
   void OnRequestSendReport();
 
-  // Following function is only called when constructing the object so no
-  // need to worry about data race.
-  void OwnsClock() {
-    owns_clock_ = true;
-  }
-
  protected:
   void RegisterChildModule(RtpRtcp* module);
 
@@ -483,8 +477,7 @@
   RTCPSender                rtcp_sender_;
   RTCPReceiver              rtcp_receiver_;
 
-  bool                      owns_clock_;
-  Clock&                    clock_;
+  Clock*                    clock_;
 
  private:
   int64_t RtcpReportInterval();
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
index dd80508..bb778f7 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender.cc
@@ -75,14 +75,14 @@
   memset(_nackByteCount, 0, sizeof(_nackByteCount));
   memset(_CSRC, 0, sizeof(_CSRC));
   // We need to seed the random generator.
-  srand( (WebRtc_UWord32)clock_.TimeInMilliseconds() );
+  srand(static_cast<WebRtc_UWord32>(clock_->TimeInMilliseconds()));
   _ssrc = _ssrcDB.CreateSSRC();  // Can't be 0.
 
   if (audio) {
-    _audio = new RTPSenderAudio(id, &clock_, this);
+    _audio = new RTPSenderAudio(id, clock_, this);
     _audio->RegisterAudioCallback(audio_feedback);
   } else {
-    _video = new RTPSenderVideo(id, &clock_, this);
+    _video = new RTPSenderVideo(id, clock_, this);
   }
   WEBRTC_TRACE(kTraceMemory, kTraceRtpRtcp, id, "%s created", __FUNCTION__);
 }
@@ -576,7 +576,7 @@
 void RTPSender::OnReceivedNACK(const WebRtc_UWord16 nackSequenceNumbersLength,
                                const WebRtc_UWord16* nackSequenceNumbers,
                                const WebRtc_UWord16 avgRTT) {
-  const WebRtc_Word64 now = clock_.TimeInMilliseconds();
+  const WebRtc_Word64 now = clock_->TimeInMilliseconds();
   WebRtc_UWord32 bytesReSent = 0;
 
   // Enough bandwidth to send NACK?
@@ -700,7 +700,7 @@
   WebRtcRTPHeader rtp_header;
   rtpParser.Parse(rtp_header);
 
-  int64_t diff_ms = clock_.TimeInMilliseconds() - capture_time_ms;
+  int64_t diff_ms = clock_->TimeInMilliseconds() - capture_time_ms;
   if (UpdateTransmissionTimeOffset(data_buffer, length, rtp_header, diff_ms)) {
     // Update stored packet in case of receiving a re-transmission request.
     _packetHistory->ReplaceRTPHeader(data_buffer,
@@ -738,7 +738,7 @@
   // TODO(holmer): This should be changed all over Video Engine so that negative
   // time is consider invalid, while 0 is considered a valid time.
   if (capture_time_ms > 0) {
-    int64_t time_now = clock_.TimeInMilliseconds();
+    int64_t time_now = clock_->TimeInMilliseconds();
     UpdateTransmissionTimeOffset(buffer, payload_length + rtp_header_length,
                                  rtp_header, time_now - capture_time_ms);
   }
@@ -1027,7 +1027,7 @@
     } else {
       frequency_hz = kDefaultVideoFrequency;
     }
-    WebRtc_UWord32 RTPtime = ModuleRTPUtility::GetCurrentRTP(&clock_,
+    WebRtc_UWord32 RTPtime = ModuleRTPUtility::GetCurrentRTP(clock_,
                                                              frequency_hz);
 
     // will be ignored if it's already configured via API
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc
index 2a28750..34f650f 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.cc
@@ -17,7 +17,7 @@
 RTPSenderAudio::RTPSenderAudio(const WebRtc_Word32 id, Clock* clock,
                                RTPSenderInterface* rtpSender) :
     _id(id),
-    _clock(*clock),
+    _clock(clock),
     _rtpSender(rtpSender),
     _audioFeedbackCritsect(CriticalSectionWrapper::CreateCriticalSection()),
     _audioFeedback(NULL),
@@ -217,7 +217,7 @@
         telephoneEvent = _dtmfKey;
         return true;
     }
-    WebRtc_Word64 delaySinceLastDTMF = _clock.TimeInMilliseconds() -
+    WebRtc_Word64 delaySinceLastDTMF = _clock->TimeInMilliseconds() -
         _dtmfTimeLastSent;
     if(delaySinceLastDTMF < 100)
     {
@@ -246,7 +246,7 @@
   if (!_dtmfEventIsOn && PendingDTMF()) {
     CriticalSectionScoped cs(_sendAudioCritsect);
 
-    WebRtc_Word64 delaySinceLastDTMF = _clock.TimeInMilliseconds() -
+    WebRtc_Word64 delaySinceLastDTMF = _clock->TimeInMilliseconds() -
         _dtmfTimeLastSent;
 
     if (delaySinceLastDTMF > 100) {
@@ -297,7 +297,7 @@
       } else {
         ended = true;
         _dtmfEventIsOn = false;
-        _dtmfTimeLastSent = _clock.TimeInMilliseconds();
+        _dtmfTimeLastSent = _clock->TimeInMilliseconds();
       }
       // don't hold the critsect while calling SendTelephoneEventPacket
       _sendAudioCritsect->Leave();
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h
index 2622812..535c0d0 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_audio.h
@@ -89,7 +89,7 @@
 
 private:
     WebRtc_Word32             _id;
-    Clock&                    _clock;
+    Clock*                    _clock;
     RTPSenderInterface*       _rtpSender;
     CriticalSectionWrapper*   _audioFeedbackCritsect;
     RtpAudioFeedback*         _audioFeedback;
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
index 055be57..cc00d40 100644
--- a/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
+++ b/webrtc/modules/rtp_rtcp/source/rtp_sender_unittest.cc
@@ -33,33 +33,6 @@
 const int kMaxPacketLength = 1500;
 }  // namespace
 
-class FakeClockTest : public Clock {
- public:
-  FakeClockTest() {
-    time_in_ms_ = 123456;
-  }
-  // Return a timestamp in milliseconds relative to some arbitrary
-  // source; the source is fixed for this clock.
-  virtual WebRtc_Word64 TimeInMilliseconds() {
-    return time_in_ms_;
-  }
-
-  virtual WebRtc_Word64 TimeInMicroseconds() {
-    return time_in_ms_ * 1000;
-  }
-
-  // Retrieve an NTP absolute timestamp.
-  virtual void CurrentNtp(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
-    secs = time_in_ms_ / 1000;
-    frac = (time_in_ms_ % 1000) * 4294967;
-  }
-  void IncrementTime(WebRtc_UWord32 time_increment_ms) {
-    time_in_ms_ += time_increment_ms;
-  }
- private:
-  WebRtc_Word64 time_in_ms_;
-};
-
 class LoopbackTransportTest : public webrtc::Transport {
  public:
   LoopbackTransportTest()
@@ -83,14 +56,14 @@
 class RtpSenderTest : public ::testing::Test {
  protected:
   RtpSenderTest()
-    : fake_clock_(),
+    : fake_clock_(123456),
       rtp_sender_(new RTPSender(0, false, &fake_clock_, &transport_, NULL,
                                 NULL)),
       kMarkerBit(true),
       kType(kRtpExtensionTransmissionTimeOffset) {
     rtp_sender_->SetSequenceNumber(kSeqNum);
   }
-  FakeClockTest fake_clock_;
+  SimulatedClock fake_clock_;
   scoped_ptr<RTPSender> rtp_sender_;
   LoopbackTransportTest transport_;
   const bool kMarkerBit;
@@ -232,7 +205,7 @@
                                           kAllowRetransmission));
   EXPECT_EQ(0, transport_.packets_sent_);
   const int kStoredTimeInMs = 100;
-  fake_clock_.IncrementTime(kStoredTimeInMs);
+  fake_clock_.AdvanceTimeMilliseconds(kStoredTimeInMs);
   // Process send bucket. Packet should now be sent.
   EXPECT_EQ(1, transport_.packets_sent_);
   EXPECT_EQ(rtp_length, transport_.last_sent_packet_len_);
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc
index 3503af2..4c9f36e 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.cc
@@ -22,7 +22,7 @@
 
 class RtpRtcpAPITest : public ::testing::Test {
  protected:
-  RtpRtcpAPITest() {
+  RtpRtcpAPITest() : module(NULL), fake_clock(123456) {
     test_CSRC[0] = 1234;
     test_CSRC[1] = 2345;
     test_id = 123;
@@ -50,7 +50,7 @@
   WebRtc_UWord32 test_timestamp;
   WebRtc_UWord16 test_sequence_number;
   WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
-  FakeRtpRtcpClock fake_clock;
+  SimulatedClock fake_clock;
 };
 
 TEST_F(RtpRtcpAPITest, Basic) {
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h
index d4bc20c..b3a30a2 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api.h
@@ -14,31 +14,6 @@
 
 namespace webrtc {
 
-class FakeRtpRtcpClock : public Clock {
- public:
-  FakeRtpRtcpClock() {
-    time_in_ms_ = 123456;
-  }
-  // Return a timestamp in milliseconds relative to some arbitrary
-  // source; the source is fixed for this clock.
-  virtual WebRtc_Word64 TimeInMilliseconds() {
-    return time_in_ms_;
-  }
-  virtual int64_t TimeInMicroseconds() {
-    return time_in_ms_ * 1000;
-  }
-  // Retrieve an NTP absolute timestamp.
-  virtual void CurrentNtp(WebRtc_UWord32& secs, WebRtc_UWord32& frac) {
-    secs = time_in_ms_ / 1000;
-    frac = (time_in_ms_ % 1000) * 4294967;
-  }
-  void IncrementTime(WebRtc_UWord32 time_increment_ms) {
-    time_in_ms_ += time_increment_ms;
-  }
- private:
-  WebRtc_Word64 time_in_ms_;
-};
-
 // This class sends all its packet straight to the provided RtpRtcp module.
 // with optional packet loss.
 class LoopBackTransport : public webrtc::Transport {
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
index ce899d7..2c0c2c2 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc
@@ -119,7 +119,7 @@
 
 class RtpRtcpAudioTest : public ::testing::Test {
  protected:
-  RtpRtcpAudioTest() {
+  RtpRtcpAudioTest() : fake_clock(123456) {
     test_CSRC[0] = 1234;
     test_CSRC[2] = 2345;
     test_id = 123;
@@ -183,7 +183,7 @@
   WebRtc_UWord32 test_timestamp;
   WebRtc_UWord16 test_sequence_number;
   WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
-  FakeRtpRtcpClock fake_clock;
+  SimulatedClock fake_clock;
 };
 
 TEST_F(RtpRtcpAudioTest, Basic) {
@@ -317,7 +317,7 @@
   for (;timeStamp <= 250 * 160; timeStamp += 160) {
     EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
                                            timeStamp, -1, test, 4));
-    fake_clock.IncrementTime(20);
+    fake_clock.AdvanceTimeMilliseconds(20);
     module1->Process();
   }
   EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10));
@@ -325,7 +325,7 @@
   for (;timeStamp <= 740 * 160; timeStamp += 160) {
     EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
                                            timeStamp, -1, test, 4));
-    fake_clock.IncrementTime(20);
+    fake_clock.AdvanceTimeMilliseconds(20);
     module1->Process();
   }
 }
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_nack.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
index 6fa81e71..b72d0b3 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_nack.cc
@@ -94,7 +94,12 @@
 
 class RtpRtcpNackTest : public ::testing::Test {
  protected:
-  RtpRtcpNackTest() {}
+  RtpRtcpNackTest()
+      : video_module_(NULL),
+        transport_(NULL),
+        nack_receiver_(NULL),
+        payload_data_length(sizeof(payload_data)),
+        fake_clock(123456) {}
   ~RtpRtcpNackTest() {}
 
   virtual void SetUp() {
@@ -127,8 +132,6 @@
     EXPECT_EQ(0, video_module_->RegisterSendPayload(video_codec));
     EXPECT_EQ(0, video_module_->RegisterReceivePayload(video_codec));
 
-    payload_data_length = sizeof(payload_data);
-
     for (int n = 0; n < payload_data_length; n++) {
       payload_data[n] = n % 10;
     }
@@ -145,7 +148,7 @@
   VerifyingNackReceiver* nack_receiver_;
   WebRtc_UWord8  payload_data[65000];
   int payload_data_length;
-  FakeRtpRtcpClock fake_clock;
+  SimulatedClock fake_clock;
 };
 
 TEST_F(RtpRtcpNackTest, RTCP) {
@@ -185,7 +188,7 @@
       nack_list[n++] = (*it);
     }
     video_module_->SendNACK(nack_list, n);
-    fake_clock.IncrementTime(33);
+    fake_clock.AdvanceTimeMilliseconds(33);
     video_module_->Process();
 
     // Prepare next frame.
@@ -242,7 +245,7 @@
       nack_list[n++] = (*it);
     }
     video_module_->SendNACK(nack_list, n);
-    fake_clock.IncrementTime(33);
+    fake_clock.AdvanceTimeMilliseconds(33);
     video_module_->Process();
 
     // Prepare next frame.
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
index d25d4cb..d2ea532 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc
@@ -78,7 +78,7 @@
 
 class RtpRtcpRtcpTest : public ::testing::Test {
  protected:
-  RtpRtcpRtcpTest() {
+  RtpRtcpRtcpTest() : fake_clock(123456) {
     test_CSRC[0] = 1234;
     test_CSRC[1] = 2345;
     test_id = 123;
@@ -171,7 +171,7 @@
   WebRtc_UWord32 test_timestamp;
   WebRtc_UWord16 test_sequence_number;
   WebRtc_UWord32 test_CSRC[webrtc::kRtpCsrcSize];
-  FakeRtpRtcpClock fake_clock;
+  SimulatedClock fake_clock;
 };
 
 TEST_F(RtpRtcpRtcpTest, RTCP_PLI_RPSI) {
@@ -194,9 +194,9 @@
   EXPECT_EQ(0, module1->AddMixedCNAME(test_CSRC[1], "jane@192.168.0.2"));
 
   // send RTCP packet, triggered by timer
-  fake_clock.IncrementTime(7500);
+  fake_clock.AdvanceTimeMilliseconds(7500);
   module1->Process();
-  fake_clock.IncrementTime(100);
+  fake_clock.AdvanceTimeMilliseconds(100);
   module2->Process();
 
   char cName[RTCP_CNAME_SIZE];
@@ -251,9 +251,9 @@
           300));
 
   // send RTCP packet, triggered by timer
-  fake_clock.IncrementTime(7500);
+  fake_clock.AdvanceTimeMilliseconds(7500);
   module1->Process();
-  fake_clock.IncrementTime(100);
+  fake_clock.AdvanceTimeMilliseconds(100);
   module2->Process();
 
   WebRtc_UWord32 receivedNTPsecs = 0;
@@ -318,7 +318,7 @@
   EXPECT_EQ(0, module1->SetSendingStatus(false));
 
   // Send RTCP packet, triggered by timer.
-  fake_clock.IncrementTime(5000);
+  fake_clock.AdvanceTimeMilliseconds(5000);
   module1->Process();
   module2->Process();
 }
@@ -330,9 +330,9 @@
   EXPECT_EQ(0u, report_blocks.size());
 
   // send RTCP packet, triggered by timer
-  fake_clock.IncrementTime(7500);
+  fake_clock.AdvanceTimeMilliseconds(7500);
   module1->Process();
-  fake_clock.IncrementTime(100);
+  fake_clock.AdvanceTimeMilliseconds(100);
   module2->Process();
 
   EXPECT_EQ(0, module1->RemoteRTCPStat(&report_blocks));
diff --git a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc
index 7a9d3db..b87904a 100644
--- a/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc
+++ b/webrtc/modules/rtp_rtcp/test/testAPI/test_api_video.cc
@@ -28,7 +28,8 @@
       : test_id_(123),
         test_ssrc_(3456),
         test_timestamp_(4567),
-        test_sequence_number_(2345) {
+        test_sequence_number_(2345),
+        fake_clock(123456) {
   }
   ~RtpRtcpVideoTest() {}
 
@@ -124,7 +125,7 @@
   WebRtc_UWord16 test_sequence_number_;
   WebRtc_UWord8  video_frame_[65000];
   int payload_data_length_;
-  FakeRtpRtcpClock fake_clock;
+  SimulatedClock fake_clock;
   enum { kPayloadType = 100 };
 };
 
@@ -157,7 +158,7 @@
       EXPECT_EQ(packet_size - 12, receiver_->rtp_header().header.paddingLength);
     }
     timestamp += 3000;
-    fake_clock.IncrementTime(33);
+    fake_clock.AdvanceTimeMilliseconds(33);
   }
 }
 
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..36131b1b 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");