this is a part of a series to migrating from `operator<<(ostream&, ..)` based formatting to fmtlib based formatting. the goal here is to enable fmtlib to print `db_clock::time_point` without the help of `operator<<`. the corresponding `operator<<()` is removed in this change, as all its callers are now using fmtlib for formatting now. Refs #13245 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
23 lines
519 B
C++
23 lines
519 B
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#include <seastar/core/print.hh>
|
|
|
|
#include "db_clock.hh"
|
|
#include "timestamp.hh"
|
|
|
|
#include "clocks-impl.hh"
|
|
|
|
std::atomic<int64_t> clocks_offset;
|
|
|
|
std::string format_timestamp(api::timestamp_type ts) {
|
|
auto t = std::time_t(std::chrono::duration_cast<std::chrono::seconds>(api::timestamp_clock::duration(ts)).count());
|
|
::tm t_buf;
|
|
return format("{}", std::put_time(::gmtime_r(&t, &t_buf), "%Y/%m/%d %T"));
|
|
}
|