From e5803f2a5d3e9567f830b75c711d7d5f0dde629b Mon Sep 17 00:00:00 2001 From: Kristine Bujold Date: Fri, 31 May 2019 10:11:06 -0400 Subject: [PATCH] Fix alarms issues on non-UTC systems This fixes two issues -Alarm clear time incorrectly reported on non-UTC systems. -Paused instances do not display the correct alarm timestamp in non-UTC systems. The mktime call that's made in fm_db_util_get_timestamp uses the local tz in it's calculation. It assumes the incoming time is also in the local time. When mktime is provided with a value in UTC we see the error presented in this bug. Change-Id: Iaf8d097e2dfdfae585b6976e02a85b9e2f1b19f9 Closes-Bug: 1828448 Signed-off-by: Kristine Bujold --- fm-common/centos/build_srpm.data | 2 +- fm-common/sources/fmDbUtils.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fm-common/centos/build_srpm.data b/fm-common/centos/build_srpm.data index 7dfb9b30..c86df7a2 100644 --- a/fm-common/centos/build_srpm.data +++ b/fm-common/centos/build_srpm.data @@ -1,2 +1,2 @@ SRC_DIR="sources" -TIS_PATCH_VER=8 +TIS_PATCH_VER=9 diff --git a/fm-common/sources/fmDbUtils.cpp b/fm-common/sources/fmDbUtils.cpp index bb363223..98790b74 100644 --- a/fm-common/sources/fmDbUtils.cpp +++ b/fm-common/sources/fmDbUtils.cpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2014-2018 Wind River Systems, Inc. +// Copyright (c) 2014-2019 Wind River Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -167,7 +167,7 @@ bool fm_db_util_get_timestamp(const char *str, FMTimeT &ft){ struct tm t; memset(&t, 0, sizeof(t)); strptime(str, "%F %T", &t); - ts.tv_sec = mktime(&t); + ts.tv_sec = timegm(&t); //now get the nanoseconds char *tstr = strdup(str); char *tobe_free = strsep(&tstr, ".");