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 <edward.welbourne@qt.io>
This commit is contained in:
Giuseppe D'Angelo 2024-05-24 14:34:23 +02:00
parent 9ec1de2528
commit 48ab909c5d

View File

@ -543,10 +543,9 @@ public:
>;
}
{
const auto sysTime = std::chrono::clock_cast<std::chrono::system_clock>(time);
// clock_cast can change the duration, so convert it again to milliseconds
const auto timeInMSec = std::chrono::time_point_cast<std::chrono::milliseconds>(sysTime);
return fromStdTimePoint(timeInMSec);
using namespace std::chrono;
const sys_time<milliseconds> sysTime = clock_cast<system_clock>(time);
return fromStdTimePoint(sysTime);
}
#endif // __cpp_concepts