time/SystemClock: pass by value

This commit is contained in:
Max Kellermann 2023-09-12 09:56:05 +02:00
parent 481c1b6f2e
commit 50f0163f5f
1 changed files with 2 additions and 2 deletions

View File

@ -12,7 +12,7 @@
template<class Rep, class Period> template<class Rep, class Period>
[[gnu::const]] [[gnu::const]]
std::chrono::system_clock::time_point std::chrono::system_clock::time_point
TimePointAfterUnixEpoch(const std::chrono::duration<Rep,Period> &d) noexcept TimePointAfterUnixEpoch(const std::chrono::duration<Rep,Period> d) noexcept
{ {
/* this is guaranteed to be 0 in C++20 */ /* this is guaranteed to be 0 in C++20 */
const auto unix_epoch = std::chrono::system_clock::from_time_t(0); const auto unix_epoch = std::chrono::system_clock::from_time_t(0);
@ -27,7 +27,7 @@ TimePointAfterUnixEpoch(const std::chrono::duration<Rep,Period> &d) noexcept
*/ */
[[gnu::const]] [[gnu::const]]
inline std::chrono::system_clock::duration inline std::chrono::system_clock::duration
DurationSinceUnixEpoch(const std::chrono::system_clock::time_point &tp) noexcept DurationSinceUnixEpoch(const std::chrono::system_clock::time_point tp) noexcept
{ {
/* this is guaranteed to be 0 in C++20 */ /* this is guaranteed to be 0 in C++20 */
const auto unix_epoch = std::chrono::system_clock::from_time_t(0); const auto unix_epoch = std::chrono::system_clock::from_time_t(0);