The C ++ standard (github.com/cplusplus/draft) has time_t conversion functions ( std::chrono::system_clock::to_time_t and std::chrono::system_clock::from_time_t ) for those listed as static and noexcept , but not constexpr .
Given that essentially all operations on time_point and duration are equal to constexpr (including duration_cast and time_point_cast ), I cannot think of any reason to exclude them. A quick look at the sources of libstdC ++ on my local machine confirms that these functions are implemented as simple values โโof duration / time _point.
Is there a reason why these two functions should not be constexpr ? Is it just a case "because no one suggested they be"?
source share