LCOV - code coverage report
Current view: top level - envoy/common - time.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 1 1 100.0 %
Date: 2024-01-05 06:35:25 Functions: 1 1 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <chrono>
       4             : 
       5             : #include "envoy/common/pure.h"
       6             : 
       7             : namespace Envoy {
       8             : 
       9             : /**
      10             :  * Less typing for common system time and steady time type.
      11             :  *
      12             :  * SystemTime should be used when getting a time to present to the user, e.g. for logging.
      13             :  * MonotonicTime should be used when tracking time for computing an interval.
      14             :  */
      15             : using Seconds = std::chrono::seconds;
      16             : using SystemTime = std::chrono::time_point<std::chrono::system_clock>;
      17             : using MonotonicTime = std::chrono::time_point<std::chrono::steady_clock>;
      18             : 
      19             : /**
      20             :  * Captures a system-time source, capable of computing both monotonically increasing
      21             :  * and real time.
      22             :  */
      23             : class TimeSource {
      24             : public:
      25       13069 :   virtual ~TimeSource() = default;
      26             : 
      27             :   /**
      28             :    * @return the current system time; not guaranteed to be monotonically increasing.
      29             :    */
      30             :   virtual SystemTime systemTime() PURE;
      31             :   /**
      32             :    * @return the current monotonic time.
      33             :    */
      34             :   virtual MonotonicTime monotonicTime() PURE;
      35             : };
      36             : 
      37             : } // namespace Envoy

Generated by: LCOV version 1.15