We propose to relax the requirements on the
template parameter of
2. Revision History
2.1. Revision 1Alter proposed wording per Jonathan Wakely’s suggestion.
2.2. Revision 0Initial revision.
It is sometimes useful to give
argument that does not meet the Cpp17Clock requirements. The most obvious use
case is the
introduced in C++20. This "clock" is not really a clock
at all. It has no functionality for getting the current time. Nevertheless, C++20
to represent a family of
time points that do not represent instants in time until they are paired with a specific
. This gives "local time" a distinct type from "system/UTC time"
in order to reduce the possibility of the programmer confusing these two types in their code.
Since the introduction of
, more use cases for "not-quite-clocks" have become apparent:
Some people need a stateful clock. This requires a non-static
It is sometimes useful to represent time points as defined by some external system not controlled by you, where you can’t generate the current time_point easily or at all.
One example might be value of timestamp counter on different computer. You can’t easily generate the current value, but you can still meaningfully manipulate existing values generated by other means: compare them, calculate differences between them, etc.
Remove paragraph 1 in [time.point]:
5. Effect on existing code
This change should not affect any conforming code because the requirement is only relaxed.
6. Effect on implementations
This change should not have an effect on most of implementations because in practice they do not use any of the members of
outside of [thread]. [thread.req.paramname] places additional requirements on the
template parameter, namely that
This change is effectively already proven to be safe because of the existence of
is an empty class.