update spdlog (it still dont work), fix 6.3(1)

This commit is contained in:
Gray
2024-06-10 16:30:29 -04:00
parent dd2bbfacda
commit bab7c30669
107 changed files with 10351 additions and 9620 deletions

View File

@@ -3,6 +3,7 @@
#pragma once
#include <chrono>
#include <spdlog/fmt/fmt.h>
// Stopwatch support for spdlog (using std::chrono::steady_clock).
@@ -16,7 +17,8 @@
// spdlog::info("Elapsed: {:.6} seconds", sw); => "Elapsed 0.005163 seconds"
//
//
// If other units are needed (e.g. millis instead of double), include "fmt/chrono.h" and use "duration_cast<..>(sw.elapsed())":
// If other units are needed (e.g. millis instead of double), include "fmt/chrono.h" and use
// "duration_cast<..>(sw.elapsed())":
//
// #include <spdlog/fmt/chrono.h>
//..
@@ -25,27 +27,25 @@
// spdlog::info("Elapsed {}", duration_cast<milliseconds>(sw.elapsed())); => "Elapsed 5ms"
namespace spdlog {
class stopwatch
{
class stopwatch {
using clock = std::chrono::steady_clock;
std::chrono::time_point<clock> start_tp_;
public:
stopwatch()
: start_tp_{clock::now()}
{}
: start_tp_{clock::now()} {}
std::chrono::duration<double> elapsed() const
{
std::chrono::duration<double> elapsed() const {
return std::chrono::duration<double>(clock::now() - start_tp_);
}
void reset()
{
start_tp_ = clock::now();
std::chrono::milliseconds elapsed_ms() const {
return std::chrono::duration_cast<std::chrono::milliseconds>(clock::now() - start_tp_);
}
void reset() { start_tp_ = clock::now(); }
};
} // namespace spdlog
} // namespace spdlog
// Support for fmt formatting (e.g. "{:012.9}" or just "{}")
namespace
@@ -56,13 +56,11 @@ namespace
#endif
{
template<>
struct formatter<spdlog::stopwatch> : formatter<double>
{
template<typename FormatContext>
auto format(const spdlog::stopwatch &sw, FormatContext &ctx) -> decltype(ctx.out())
{
template <>
struct formatter<spdlog::stopwatch> : formatter<double> {
template <typename FormatContext>
auto format(const spdlog::stopwatch &sw, FormatContext &ctx) const -> decltype(ctx.out()) {
return formatter<double>::format(sw.elapsed().count(), ctx);
}
};
} // namespace std
} // namespace std