OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| 6 #define MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/time/default_tick_clock.h" |
| 10 #include "base/time/tick_clock.h" |
| 11 #include "base/time/time.h" |
| 12 #include "media/cast/cast_defines.h" |
| 13 |
| 14 namespace media { |
| 15 namespace cast { |
| 16 |
| 17 // Class that provide the a TickTime relative to NTP. The base TickTime does not |
| 18 // reference a specific date. This version is number of ticks relative to 0h UTC |
| 19 // on 1 January 1900. |
| 20 // Note: We only synchronize with the system clock at creation time after that |
| 21 // we only use our relative difference this can result in a drift relative to |
| 22 // the system clock however this approach guarantees that our NTP time never |
| 23 // decrease. |
| 24 |
| 25 class CastNtpTickClock : public base::TickClock { |
| 26 public: |
| 27 CastNtpTickClock(); |
| 28 virtual ~CastNtpTickClock(); |
| 29 |
| 30 virtual base::TimeTicks NowTicks() OVERRIDE; |
| 31 |
| 32 protected: |
| 33 // Provided for testability. |
| 34 void SetTickClock(base::TickClock* tick_clock); |
| 35 |
| 36 private: |
| 37 base::DefaultTickClock default_tick_clock_; |
| 38 base::TickClock* tick_clock_; |
| 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(CastNtpTickClock); |
| 41 }; |
| 42 |
| 43 } // namespace cast |
| 44 } // namespace media |
| 45 |
| 46 #endif // MEDIA_CAST_CAST_NTP_TICK_CLOCK_H_ |
| 47 |
| 48 |
OLD | NEW |