Make some methods in Clock class const declared

R=henrike@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6375 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/system_wrappers/interface/clock.h b/webrtc/system_wrappers/interface/clock.h
index 38ce0d5..c03f976 100644
--- a/webrtc/system_wrappers/interface/clock.h
+++ b/webrtc/system_wrappers/interface/clock.h
@@ -32,17 +32,17 @@
 
   // Return a timestamp in milliseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMilliseconds() = 0;
+  virtual int64_t TimeInMilliseconds() const = 0;
 
   // Return a timestamp in microseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMicroseconds() = 0;
+  virtual int64_t TimeInMicroseconds() const = 0;
 
   // Retrieve an NTP absolute timestamp in seconds and fractions of a second.
-  virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) = 0;
+  virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) const = 0;
 
   // Retrieve an NTP absolute timestamp in milliseconds.
-  virtual int64_t CurrentNtpInMilliseconds() = 0;
+  virtual int64_t CurrentNtpInMilliseconds() const = 0;
 
   // Converts an NTP timestamp to a millisecond timestamp.
   static int64_t NtpToMs(uint32_t seconds, uint32_t fractions);
@@ -59,17 +59,18 @@
 
   // Return a timestamp in milliseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMilliseconds() OVERRIDE;
+  virtual int64_t TimeInMilliseconds() const OVERRIDE;
 
   // Return a timestamp in microseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMicroseconds() OVERRIDE;
+  virtual int64_t TimeInMicroseconds() const OVERRIDE;
 
   // Retrieve an NTP absolute timestamp in milliseconds.
-  virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) OVERRIDE;
+  virtual void CurrentNtp(uint32_t& seconds,
+                          uint32_t& fractions) const OVERRIDE;
 
   // Converts an NTP timestamp to a millisecond timestamp.
-  virtual int64_t CurrentNtpInMilliseconds() OVERRIDE;
+  virtual int64_t CurrentNtpInMilliseconds() const OVERRIDE;
 
   // Advance the simulated clock with a given number of milliseconds or
   // microseconds.
diff --git a/webrtc/system_wrappers/source/clock.cc b/webrtc/system_wrappers/source/clock.cc
index aa80f8f..33eb856 100644
--- a/webrtc/system_wrappers/source/clock.cc
+++ b/webrtc/system_wrappers/source/clock.cc
@@ -129,18 +129,19 @@
 class RealTimeClock : public Clock {
   // Return a timestamp in milliseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMilliseconds() OVERRIDE {
+  virtual int64_t TimeInMilliseconds() const OVERRIDE {
     return TickTime::MillisecondTimestamp();
   }
 
   // Return a timestamp in microseconds relative to some arbitrary source; the
   // source is fixed for this clock.
-  virtual int64_t TimeInMicroseconds() OVERRIDE {
+  virtual int64_t TimeInMicroseconds() const OVERRIDE {
     return TickTime::MicrosecondTimestamp();
   }
 
   // Retrieve an NTP absolute timestamp in seconds and fractions of a second.
-  virtual void CurrentNtp(uint32_t& seconds, uint32_t& fractions) OVERRIDE {
+  virtual void CurrentNtp(uint32_t& seconds,
+                          uint32_t& fractions) const OVERRIDE {
     timeval tv = CurrentTimeVal();
     double microseconds_in_seconds;
     Adjust(tv, &seconds, &microseconds_in_seconds);
@@ -149,7 +150,7 @@
   }
 
   // Retrieve an NTP absolute timestamp in milliseconds.
-  virtual int64_t CurrentNtpInMilliseconds() OVERRIDE {
+  virtual int64_t CurrentNtpInMilliseconds() const OVERRIDE {
     timeval tv = CurrentTimeVal();
     uint32_t seconds;
     double microseconds_in_seconds;
@@ -270,24 +271,24 @@
 SimulatedClock::~SimulatedClock() {
 }
 
-int64_t SimulatedClock::TimeInMilliseconds() {
+int64_t SimulatedClock::TimeInMilliseconds() const {
   ReadLockScoped synchronize(*lock_);
   return (time_us_ + 500) / 1000;
 }
 
-int64_t SimulatedClock::TimeInMicroseconds() {
+int64_t SimulatedClock::TimeInMicroseconds() const {
   ReadLockScoped synchronize(*lock_);
   return time_us_;
 }
 
-void SimulatedClock::CurrentNtp(uint32_t& seconds, uint32_t& fractions) {
+void SimulatedClock::CurrentNtp(uint32_t& seconds, uint32_t& fractions) const {
   int64_t now_ms = TimeInMilliseconds();
   seconds = (now_ms / 1000) + kNtpJan1970;
   fractions =
       static_cast<uint32_t>((now_ms % 1000) * kMagicNtpFractionalUnit / 1000);
 }
 
-int64_t SimulatedClock::CurrentNtpInMilliseconds() {
+int64_t SimulatedClock::CurrentNtpInMilliseconds() const {
   return TimeInMilliseconds() + 1000 * static_cast<int64_t>(kNtpJan1970);
 }