Is this just a case of "because no one proposed they should be"?
Yes, I think that is exactly right.
I'm curious: Once you get a constexpr time_t
, what are you going to do with it? None of the C functions taking time_t
are constexpr
.
Question
The C++ standard (github.com/cplusplus/draft) has the time_t
conversion functions (std::chrono::system_clock::to_time_t
and std::chrono::system_clock::from_time_t
) for listed as static
and noexcept
but not constexpr
.
Given that essentially all of the operations on time_point
and duration
are constexpr
(including duration_cast
and time_point_cast
), I can't think of any reason to exclude them. A quick inspection of the libstdc++ sources on my local machine confirms that these functions are implemented as simple duration/time_point casts.
Is there any reason that these two functions should not be constexpr
? Is this just a case of "because no one proposed they should be"?
Solution
Is this just a case of "because no one proposed they should be"?
Yes, I think that is exactly right.
I'm curious: Once you get a constexpr time_t
, what are you going to do with it? None of the C functions taking time_t
are constexpr
.