C++ Logo

std-proposals

Advanced search

Re: C++20 chrono library can't use max date?

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sat, 21 Dec 2019 09:18:52 -0800
On Saturday, 21 December 2019 05:42:44 PST Andrey Semashev via Std-Proposals
wrote:
> Time points and durations, at least from the system and steady clocks,
> are not intended to be used for representing calendar dates, especially
> not in the far past or future. One of their main use cases is relatively
> short term timed operations (e.g. various timeouts, operation intervals
> and scheduling, etc.), meaning that magnitute orders of sub-seconds to
> seconds are much more prevalent than hours, days or even years. These
> clocks and associated time points and durations are designed to be
> efficient for that use case. Choosing e.g. a larger representation type
> to increase the range would add unneeded performance overhead.

Agreed on that and adding that the libstdc++ filesystem clock is different
from the system_clock, with a different range.

std::chrono can be used for other purposes. It's the standard clocks that
aren't meant o, like Andrey said. There's no point in having system_clock
support dates before any valid system dates.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products

Received on 2019-12-21 11:21:20