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 66d8be6 commit 7ebc71dCopy full SHA for 7ebc71d
src/logger.cc
@@ -77,7 +77,7 @@ std::string timestamp(const char* format) {
77
// Thread-local per-second UTC timestamp cache.
78
struct TimeCache {
79
time_t second = 0;
80
- char buf[32];
+ char buf[64];
81
size_t len = 0;
82
};
83
thread_local TimeCache cache;
@@ -98,7 +98,10 @@ std::string timestamp(const char* format) {
98
99
cache.len = ::strftime(cache.buf, sizeof(cache.buf), format, &tmBuf);
100
cache.second = currentTime;
101
-
+ if (cache.len == 0) {
102
+ // Formatting failure fallback.
103
+ return "";
104
+ }
105
return std::string(cache.buf, cache.len);
106
}
107
0 commit comments