From 3eecb0e32b1ea21ab336f90f889a8eb7bb655a03 Mon Sep 17 00:00:00 2001 From: John Colvin Date: Fri, 2 Aug 2024 13:15:07 +0000 Subject: [PATCH] Make a few timestamp fns const They should have been const in the first place --- src/lib/core/TimeStamp.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/core/TimeStamp.h b/src/lib/core/TimeStamp.h index 648dda648..2f2afdf91 100644 --- a/src/lib/core/TimeStamp.h +++ b/src/lib/core/TimeStamp.h @@ -50,8 +50,8 @@ struct TimeStamp { constexpr double total_millis() const; constexpr double total_seconds() const; - constexpr std::int64_t to_int64(); - inline void to_date(uint32_t &year, uint32_t &month, uint32_t &day); + constexpr std::int64_t to_int64() const; + inline void to_date(uint32_t &year, uint32_t &month, uint32_t &day) const; constexpr boost::posix_time::ptime to_ptime() const; std::string to_iso_string() const; // current epoch ns @@ -144,13 +144,13 @@ constexpr double TimeStamp::total_seconds() const { return static_cast(value_) / 1000'000'000; } -constexpr std::int64_t TimeStamp::to_int64() { +constexpr std::int64_t TimeStamp::to_int64() const { bts_assert( value_ <= static_cast(std::numeric_limits::max())); return static_cast(value_); } -void TimeStamp::to_date(uint32_t &year, uint32_t &month, uint32_t &day) { +void TimeStamp::to_date(uint32_t &year, uint32_t &month, uint32_t &day) const { std::uint64_t epoch_secs = value_ / (1000 * 1000 * 1000); time_t ts_tt(epoch_secs); struct tm *ptm = gmtime(&ts_tt);