C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 08 Mar 2025 19:23:43 -0800
On Saturday, 8 March 2025 18:24:48 Pacific Standard Time Tom Honermann via Std-
Proposals wrote:
> What evidence exists that indicates that a constexpr
> std::chrono::system_clock::now() would be employed in problematic ways
> in practice and that wouldn't be sufficiently addressed by options like
> those above (particularly SOURCE_DATE_EPOCH)? I acknowledge that the
> ability to compute durations during constant evaluation would pose a new
> scenario that is not possible with __TIME__ today. Is that significant?

The compiler implementers in the list can probably speak more about this, but
I suspect the implementation would return the same time stamp for ALL calls in
the compilation, matching that of __TIME__. That is, if you tried to time the
execution, you'd find out that it was instantaneous (or shorter than the
minimum granularity).

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-03-09 03:23:50