quic_clock_skew_detector.h 955 B

123456789101112131415161718192021222324252627282930
  1. // Copyright (c) 2012 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. #ifndef NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_
  5. #define NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_
  6. #include "base/time/time.h"
  7. #include "net/base/net_export.h"
  8. namespace net {
  9. class NET_EXPORT_PRIVATE QuicClockSkewDetector {
  10. public:
  11. QuicClockSkewDetector(base::TimeTicks ticks_time, base::Time wall_time);
  12. // Returns true if the delta between |wall_now| and |last_wall_time_| is
  13. // more than one second larger than the delta between |ticks_now| and
  14. // |last_ticks_time_|. Updates |last_ticks_time_| and |last_wall_time_|.
  15. bool ClockSkewDetected(base::TimeTicks ticks_now, base::Time wall_now);
  16. private:
  17. // Clock skew detection members
  18. base::TimeTicks last_ticks_time_;
  19. base::Time last_wall_time_;
  20. };
  21. } // namespace net
  22. #endif // NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_