This commit is contained in:
gabime
2014-01-27 11:44:10 +02:00
parent fa6f8b3c9a
commit 9934ea4044
11 changed files with 22 additions and 296 deletions

View File

@@ -10,10 +10,10 @@ void c11log::formatters::format_time(const c11log::formatters::timepoint& tp, st
int millis = static_cast<int>(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count() % 1000);
//std::put_time(&tm, "[ %Y-%m-%d %H:%M:%S ]") - seems too slow
char buf[64];
sprintf(buf, "[%d-%02d-%02d %02d:%02d:%02d.%03d]",
auto size = sprintf(buf, "[%d-%02d-%02d %02d:%02d:%02d.%03d]",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
tm.tm_hour, tm.tm_min, tm.tm_sec, millis);
dest << buf;
dest.write(buf, size);
}
void c11log::formatters::format_time(std::ostream& dest)
@@ -33,4 +33,4 @@ std::string c11log::formatters::to_hex(const unsigned char* buf, std::size_t siz
oss << _hex_chars[buf[i] & 0x0F];
}
return oss.str();
}
}