Make a few timestamp fns const

They should have been const in the first place
This commit is contained in:
John Colvin committed 2024-09-25 06:11:16 +00:00
1 parent b03790f9da
commit 3eecb0e32b
1 file changed
+4 -4
+4 -4
View File
@@ -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<double>(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::int64_t>(std::numeric_limits<std::int64_t>::max()));
return static_cast<std::int64_t>(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);