Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b00c4c commit 38315c0Copy full SHA for 38315c0
include/rpc/detail/log.h
@@ -83,11 +83,19 @@ class logger {
83
std::stringstream ss;
84
timespec now_t = {};
85
clock_gettime(CLOCK_REALTIME, &now_t);
86
+#if __GNUC__ >= 5
87
ss << std::put_time(
88
std::localtime(reinterpret_cast<time_t *>(&now_t.tv_sec)),
89
"%F %T")
- << RPCLIB_FMT::format(
90
+#else
91
+ char mltime[128];
92
+ strftime(mltime, sizeof(mltime), "%c %Z",
93
+ std::localtime(reinterpret_cast<time_t *>(&now_t.tv_sec)));
94
+ ss << mltime
95
+#endif
96
+ << RPCLIB_FMT::format(
97
".{:03}", round(static_cast<double>(now_t.tv_nsec) / 1.0e6));
98
+
99
return ss.str();
100
}
101
#endif
0 commit comments