xref: /aosp_15_r20/external/cronet/net/quic/quic_clock_skew_detector.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2012 The Chromium Authors
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 NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_
6 #define NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_
7 
8 #include "base/time/time.h"
9 #include "net/base/net_export.h"
10 
11 namespace net {
12 
13 class NET_EXPORT_PRIVATE QuicClockSkewDetector {
14  public:
15   QuicClockSkewDetector(base::TimeTicks ticks_time, base::Time wall_time);
16 
17   // Returns true if the delta between |wall_now| and |last_wall_time_| is
18   // more than one second larger than the delta between |ticks_now| and
19   // |last_ticks_time_|.  Updates |last_ticks_time_| and |last_wall_time_|.
20   bool ClockSkewDetected(base::TimeTicks ticks_now, base::Time wall_now);
21 
22  private:
23   // Clock skew detection members
24   base::TimeTicks last_ticks_time_;
25   base::Time last_wall_time_;
26 };
27 
28 }  // namespace net
29 
30 #endif  // NET_QUIC_QUIC_CLOCK_SKEW_DETECTOR_H_
31