mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
clang-format
This commit is contained in:
@@ -14,16 +14,13 @@
|
||||
#include <ctime>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable: 4702) // unreachable code
|
||||
# pragma warning(disable: 4996) // "deprecated" functions
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4702) // unreachable code
|
||||
#pragma warning(disable : 4996) // "deprecated" functions
|
||||
#endif
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
template <typename ArgFormatter>
|
||||
void format_arg(BasicFormatter<char, ArgFormatter> &f,
|
||||
const char *&format_str, const std::tm &tm)
|
||||
namespace fmt {
|
||||
template <typename ArgFormatter> void format_arg(BasicFormatter<char, ArgFormatter> &f, const char *&format_str, const std::tm &tm)
|
||||
{
|
||||
if (*format_str == ':')
|
||||
++format_str;
|
||||
@@ -60,8 +57,7 @@ void format_arg(BasicFormatter<char, ArgFormatter> &f,
|
||||
format_str = end + 1;
|
||||
}
|
||||
|
||||
namespace internal
|
||||
{
|
||||
namespace internal {
|
||||
inline Null<> localtime_r(...)
|
||||
{
|
||||
return Null<>();
|
||||
@@ -78,7 +74,7 @@ inline Null<> gmtime_s(...)
|
||||
{
|
||||
return Null<>();
|
||||
}
|
||||
}
|
||||
} // namespace internal
|
||||
|
||||
// Thread-safe replacement for std::localtime
|
||||
inline std::tm localtime(std::time_t time)
|
||||
@@ -88,7 +84,10 @@ inline std::tm localtime(std::time_t time)
|
||||
std::time_t time_;
|
||||
std::tm tm_;
|
||||
|
||||
LocalTime(std::time_t t): time_(t) {}
|
||||
LocalTime(std::time_t t)
|
||||
: time_(t)
|
||||
{
|
||||
}
|
||||
|
||||
bool run()
|
||||
{
|
||||
@@ -116,7 +115,8 @@ inline std::tm localtime(std::time_t time)
|
||||
{
|
||||
using namespace fmt::internal;
|
||||
std::tm *tm = std::localtime(&time_);
|
||||
if (tm) tm_ = *tm;
|
||||
if (tm)
|
||||
tm_ = *tm;
|
||||
return tm != FMT_NULL;
|
||||
}
|
||||
};
|
||||
@@ -136,7 +136,10 @@ inline std::tm gmtime(std::time_t time)
|
||||
std::time_t time_;
|
||||
std::tm tm_;
|
||||
|
||||
GMTime(std::time_t t): time_(t) {}
|
||||
GMTime(std::time_t t)
|
||||
: time_(t)
|
||||
{
|
||||
}
|
||||
|
||||
bool run()
|
||||
{
|
||||
@@ -163,7 +166,8 @@ inline std::tm gmtime(std::time_t time)
|
||||
bool fallback(internal::Null<>)
|
||||
{
|
||||
std::tm *tm = std::gmtime(&time_);
|
||||
if (tm != FMT_NULL) tm_ = *tm;
|
||||
if (tm != FMT_NULL)
|
||||
tm_ = *tm;
|
||||
return tm != FMT_NULL;
|
||||
}
|
||||
};
|
||||
@@ -174,10 +178,10 @@ inline std::tm gmtime(std::time_t time)
|
||||
FMT_THROW(fmt::FormatError("time_t value out of range"));
|
||||
return std::tm();
|
||||
}
|
||||
} //namespace fmt
|
||||
} // namespace fmt
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // FMT_TIME_H_
|
||||
#endif // FMT_TIME_H_
|
||||
|
Reference in New Issue
Block a user