From 8cb160c6c4a2edcc33417eebd34f49b07d1bbe6a Mon Sep 17 00:00:00 2001 From: Lukasz Bardeli Date: Thu, 30 Apr 2015 14:04:19 +0200 Subject: [PATCH] [Messaging] Fix in toTimeT method [Verification] Code compiles without error. Passrate 100% (184/184/0/0/0) Change-Id: I43c6040ccb21f36bf56985d003103df69e046c86 Signed-off-by: Lukasz Bardeli --- src/messaging/MsgCommon/Any.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/messaging/MsgCommon/Any.cpp b/src/messaging/MsgCommon/Any.cpp index 31dfe1e5..cb4bcab2 100644 --- a/src/messaging/MsgCommon/Any.cpp +++ b/src/messaging/MsgCommon/Any.cpp @@ -165,7 +165,13 @@ std::time_t Any::toTimeT() const std::time_t current_time; std::time(¤t_time); std::tm* timeinfo = std::localtime(¤t_time); - return mktime(toDateTm()) + timeinfo->tm_gmtoff; + long int gmtoff = timeinfo->tm_gmtoff; + if (timeinfo->tm_isdst) { + // if dst is set then 1 hour should be subtracted. + // 1 hour = 60 second * 60 minutes = 3600 seconds + gmtoff -= 3600; + } + return mktime(toDateTm()) + gmtoff; } } // Tizen -- 2.34.1