In this web content, the author discusses different approaches to designing a system that relies on time and is testable. The author’s experience primarily comes from networking, where timely responses are crucial. The naive approach of using std::chrono::::now() makes unit tests impossible. Instead, the author suggests several alternative approaches. One approach involves using a clock alias, while another leverages template specialization access. The author also suggests a clock factory or passing time stamps as possible solutions. Each approach has its advantages and drawbacks, and the best choice depends on the desired level of precision and ease of testing.
https://playfulprogramming.blogspot.com/2023/12/about-time.html