LCOV - code coverage report
Current view: top level - utils - TimeUtils.h (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 100.0 % 3 3
Test Date: 2026-03-18 19:01:10 Functions: 100.0 % 1 1
Branches: 100.0 % 2 2

             Branch data     Line data    Source code
       1                 :             : #ifndef TIMEOUTILS_H
       2                 :             : #define TIMEOUTILS_H
       3                 :             : 
       4                 :             : #include <chrono>
       5                 :             : 
       6                 :             : #ifdef LMUFFB_UNIT_TEST
       7                 :             : // These are defined in main_test_runner.cpp
       8                 :             : extern std::chrono::steady_clock::time_point g_mock_time;
       9                 :             : extern bool g_use_mock_time;
      10                 :             : #endif
      11                 :             : 
      12                 :             : namespace TimeUtils {
      13                 :             :     /**
      14                 :             :      * @brief A simple interface for providing the current time.
      15                 :             :      * Allows for mocking in unit tests.
      16                 :             :      */
      17                 :       12418 :     inline std::chrono::steady_clock::time_point GetTime() {
      18                 :             : #ifdef LMUFFB_UNIT_TEST
      19         [ +  + ]:       12418 :         if (g_use_mock_time) return g_mock_time;
      20                 :             : #endif
      21                 :        2888 :         return std::chrono::steady_clock::now();
      22                 :             :     }
      23                 :             : }
      24                 :             : 
      25                 :             : #endif // TIMEOUTILS_H
        

Generated by: LCOV version 2.0-1