summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorypostolov <ypostolov@luxoft.com>2020-02-27 10:58:37 +0200
committeryurii <ypostolov>2020-03-26 15:02:49 +0200
commit438125b81b91f9d38fe450e11f15eac6687a54b1 (patch)
treeaeacbc430d3867e10109bf3d75597a14108c1533
parent5abc8af29db02377b7a0c3c43d41d50ba0b2b2d6 (diff)
downloadsdl_core-438125b81b91f9d38fe450e11f15eac6687a54b1.tar.gz
fixed issue asctimeCalled
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc
index fb9243d726..8386938de4 100644
--- a/src/components/security_manager/src/crypto_manager_impl.cc
+++ b/src/components/security_manager/src/crypto_manager_impl.cc
@@ -347,13 +347,19 @@ bool CryptoManagerImpl::IsCertificateUpdateRequired(
const double seconds = difftime(certificates_time, system_time);
- LOG4CXX_DEBUG(
- logger_,
- // cppcheck-suppress asctimeCalled
- "Certificate UTC time: " << asctime(gmtime(&certificates_time)));
+#ifdef ENABLE_LOG
+ struct tm* cert_time = gmtime(&certificates_time);
+ struct tm* sys_time = gmtime(&system_time);
+ char buf[80];
+
+ // ISO_8601 format is expected, e.g. “2000-01-01T12:18:53Z”
+ strftime(buf, sizeof(buf), "%Y-%m-%dT%XZ", cert_time);
+ LOG4CXX_DEBUG(logger_, "Certificate UTC time: " << buf);
+
+ strftime(buf, sizeof(buf), "%Y-%m-%dT%XZ", sys_time);
+ LOG4CXX_DEBUG(logger_, "Host UTC time: " << sys_time);
+#endif
- // cppcheck-suppress asctimeCalled
- LOG4CXX_DEBUG(logger_, "Host UTC time: " << asctime(gmtime(&system_time)));
LOG4CXX_DEBUG(logger_, "Seconds before expiration: " << seconds);
if (seconds < 0) {
LOG4CXX_WARN(logger_, "Certificate is already expired.");