C++ Logo

std-proposals

Advanced search

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

From: Thiago Macieira <thiago_at_[hidden]>
Date: Fri, 07 Mar 2025 08:10:45 -0800
On Friday, 7 March 2025 01:22:18 Pacific Standard Time Tiago Freire via Std-
Proposals wrote:
> I'm not joking. There's nothing that guarantees that the clock has enough
> precision to give you 2 different values when called twice. Which defeats
> the purpose of being "Unique", it would be everything else but the time
> that would have to pull the work of making it unique.

That's why I suggested that Nik update the proposal to say this time-based
UUIDv1 be used as a fallback in case a better solution can't be found at
runtime. The text should also suggest that such generated UUID should be
verified at runtime for uniqueness and discarded if they weren't.

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

Received on 2025-03-07 16:10:46