Skip to content

Commit d4b661a

Browse files
committed
Move DateTimeStrFormat to make clang happy for MacOS compiles.
1 parent 5e61697 commit d4b661a

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

src/logging.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
// Unavoidable because these are in util.h.
2020
extern fs::path &GetDataDir(bool fNetSpecific);
21-
extern std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime);
2221
extern bool GetBoolArg(const std::string& strArg, bool fDefault);
2322
extern int64_t GetArg(const std::string& strArg, int64_t nDefault);
2423

src/logging.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,21 @@ extern bool fLogIPs;
3131
// Unavoidable because this is in util.h.
3232
extern int64_t GetAdjustedTime();
3333

34+
inline std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
35+
{
36+
time_t n = nTime;
37+
struct tm* ptmTime = gmtime(&n);
38+
char pszTime[200];
39+
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
40+
return pszTime;
41+
}
42+
43+
static const std::string strTimestampFormat = "%Y-%m-%d %H:%M:%S UTC";
44+
inline std::string DateTimeStrFormat(int64_t nTime)
45+
{
46+
return DateTimeStrFormat(strTimestampFormat.c_str(), nTime);
47+
}
48+
3449
struct CLogCategoryActive
3550
{
3651
std::string category;

src/util.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -275,21 +275,6 @@ inline int64_t GetPerformanceCounter()
275275
return nCounter;
276276
}
277277

278-
inline std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
279-
{
280-
time_t n = nTime;
281-
struct tm* ptmTime = gmtime(&n);
282-
char pszTime[200];
283-
strftime(pszTime, sizeof(pszTime), pszFormat, ptmTime);
284-
return pszTime;
285-
}
286-
287-
static const std::string strTimestampFormat = "%Y-%m-%d %H:%M:%S UTC";
288-
inline std::string DateTimeStrFormat(int64_t nTime)
289-
{
290-
return DateTimeStrFormat(strTimestampFormat.c_str(), nTime);
291-
}
292-
293278
inline bool IsSwitchChar(char c)
294279
{
295280
#ifdef WIN32

0 commit comments

Comments
 (0)