-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Labels
Description
Describe the bug
I cant compile a test case with a "non-standard time_point" (see blow) against catch v3. The bug is present in catch v2, but there the stringmaker for chrono was disabled.
Expected behavior
it should compile :)
Reproduction steps
TEST_CASE("chrono") {
std::chrono::time_point<std::chrono::system_clock, std::chrono::nanoseconds> tp1, tp2;
CHECK(tp1 == tp2);
}Platform information:
- OS: Windows 10
- Compiler+version: vs2019
- Catch version: v3.3.2
Additional context
- The Problem is in https://github.com/catchorg/Catch2/blob/devel/src/catch2/catch_tostring.hpp#LL627C39-L627C39
to_time_tassumes a timestamp with the same duration as the standard system_clock- on windows, this duration is 100/ns - but I have time_points with a duration of 1ns
- a solution could be to cast:
auto converted = std::chrono::system_clock::to_time_t(std::chrono::time_point_cast<std::chrono::system_clock::duration>(time_point));
Reactions are currently unavailable