From 48ab909c5d34f024ec8f1c44cfb5b373e8689ba4 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 24 May 2024 14:34:23 +0200 Subject: [PATCH] QDateTime::fromStdTimePoint: remove an unnecessary time_point_cast The constraint now checks that the result of the clock_cast has a duration which is convertible to milliseconds, so just do the implicit conversion, without any cast for the duration. Task-number: QTBUG-125587 Change-Id: Id2c8232d756318c3e4d33cd7e1556773961a9dba Reviewed-by: Edward Welbourne --- src/corelib/time/qdatetime.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/corelib/time/qdatetime.h b/src/corelib/time/qdatetime.h index 70a79a4f874..77247dcd078 100644 --- a/src/corelib/time/qdatetime.h +++ b/src/corelib/time/qdatetime.h @@ -543,10 +543,9 @@ public: >; } { - const auto sysTime = std::chrono::clock_cast(time); - // clock_cast can change the duration, so convert it again to milliseconds - const auto timeInMSec = std::chrono::time_point_cast(sysTime); - return fromStdTimePoint(timeInMSec); + using namespace std::chrono; + const sys_time sysTime = clock_cast(time); + return fromStdTimePoint(sysTime); } #endif // __cpp_concepts