|
|
@@ -30,7 +30,12 @@ namespace logging {
|
|
|
namespace {
|
|
|
std::string fmt_time(struct timeval round, char const * const fmt) {
|
|
|
struct tm time;
|
|
|
- gmtime_r(&round.tv_sec, &time);
|
|
|
+ // Supports localtime when requested, but you can't really test that
|
|
|
+ if (strstr(fmt, "%z") || strstr(fmt, "%Z")) {
|
|
|
+ localtime_r(&round.tv_sec, &time);
|
|
|
+ } else {
|
|
|
+ gmtime_r(&round.tv_sec, &time);
|
|
|
+ }
|
|
|
char buf[64] = {'\0'};
|
|
|
std::strftime(buf, sizeof(buf), fmt, &time);
|
|
|
return buf;
|