[Libreoffice-commits] online.git: common/Log.cpp
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Tue Jan 10 05:40:06 UTC 2017
common/Log.cpp | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
New commits:
commit 89bd85fbba9855a607619bbda279c14da3d9cc5f
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Mon Jan 9 12:33:01 2017 -0500
wsd: put_time is not supported by gcc4.8
Change-Id: Ib3b6a115ba669051474e327944cb4677575d15f3
Reviewed-on: https://gerrit.libreoffice.org/32917
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/common/Log.cpp b/common/Log.cpp
index 3141abd..380b0ed 100644
--- a/common/Log.cpp
+++ b/common/Log.cpp
@@ -158,9 +158,22 @@ namespace Log
const std::time_t t = std::time(nullptr);
oss.str("");
oss.clear();
- oss << "Initializing " << name << ". Local time: " << std::put_time(std::localtime(&t), "%c %Z")
- << ". UTC: " << std::put_time(std::gmtime(&t), "%c %Z")
- << ". Log level is [" << logger.getLevel() << "].";
+
+ oss << "Initializing " << name << ".";
+
+ // TODO: replace with std::put_time when we move to gcc 5+.
+ char buf[32];
+ if (strftime(buf, sizeof(buf), "%a %F %T%z", std::localtime(&t)) > 0)
+ {
+ oss << " Local time: " << buf << ".";
+ }
+
+ if (strftime(buf, sizeof(buf), "%a %F %T%z", std::gmtime(&t)) > 0)
+ {
+ oss << " UTC time: " << buf << ".";
+ }
+
+ oss << " Log level is [" << logger.getLevel() << "].";
info(oss.str());
}
More information about the Libreoffice-commits
mailing list