C++ Logo

std-proposals

Advanced search

Re: [std-proposals] constexpr support for std::chrono::system_clock

From: Howard Hinnant <howard.hinnant_at_[hidden]>
Date: Thu, 6 Mar 2025 20:58:58 -0500
If we could change the C++ standard to say that __DATE__ and __TIME__ are UTC, then the user could write this clock themselves. And that user-written clock could even return a system_clock::time_point.

On macOS __DATE__ and __TIME__ are in the local time zone. And that blows a user-written clock out of the water unless the user can somehow inject the current local UTC offset into the build system.

The advantage of basing it to on a UTC __DATE__ and __TIME__ is that the existing infrastructure for manipulating __DATE__ and __TIME__ remains and could manipulate this chrono::time_point.

Howard

Received on 2025-03-07 01:59:31