xref: /aosp_15_r20/external/cronet/net/third_party/quiche/src/quiche/quic/core/quic_default_clock.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2022 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 QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_
6 #define QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_
7 
8 #include "quiche/quic/core/quic_clock.h"
9 #include "quiche/quic/core/quic_time.h"
10 #include "quiche/quic/platform/api/quic_export.h"
11 
12 namespace quic {
13 
14 // A QuicClock based on Abseil time API.  Thread-safe.
15 class QUICHE_EXPORT QuicDefaultClock : public QuicClock {
16  public:
17   // Provides a single default stateless instance of QuicDefaultClock.
18   static QuicDefaultClock* Get();
19 
20   explicit QuicDefaultClock() = default;
21   QuicDefaultClock(const QuicDefaultClock&) = delete;
22   QuicDefaultClock& operator=(const QuicDefaultClock&) = delete;
23 
24   // QuicClock implementation.
25   QuicTime ApproximateNow() const override;
26   QuicTime Now() const override;
27   QuicWallTime WallNow() const override;
28 };
29 
30 }  // namespace quic
31 
32 #endif  // QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_
33