Compare commits
2 Commits
| Author | SHA256 | Date | |
|---|---|---|---|
| b705a7af00 | |||
| 45721c20d8 |
48
libservicelog-Fix-timezone-handling-in-servicelog-ev.patch
Normal file
48
libservicelog-Fix-timezone-handling-in-servicelog-ev.patch
Normal file
@@ -0,0 +1,48 @@
|
||||
From e04118be57df7647ccee5b09393866d2b0a678ec Mon Sep 17 00:00:00 2001
|
||||
From: Sathvika Vasireddy <sv@linux.ibm.com>
|
||||
Date: Thu, 8 Jan 2026 12:26:31 +0530
|
||||
Subject: [PATCH] libservicelog: Fix timezone handling in servicelog event
|
||||
parsing
|
||||
|
||||
Replace mktime() with timegm() when parsing datetime fields from SQLite
|
||||
database. SQLite's DATETIME('NOW') returns UTC timestamps, but mktime()
|
||||
treats input as local time, causing incorrect timezone conversions.
|
||||
|
||||
Use timegm() to correctly interpret the UTC timestamps from the database,
|
||||
ensuring accurate time representation.
|
||||
|
||||
Tested-by: Krishan Gopal Saraswat <krishang@linux.ibm.com>
|
||||
Reviewed-by: Mahesh Salgaonkar <mahesh@linux.ibm.com>
|
||||
Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
|
||||
---
|
||||
src/event.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/event.c b/src/event.c
|
||||
index 32c6a9c..11358a1 100644
|
||||
--- a/src/event.c
|
||||
+++ b/src/event.c
|
||||
@@ -620,17 +620,17 @@ servicelog_event_query(servicelog *slog, char *query,
|
||||
else if (!strcmp(name, "time_logged")) {
|
||||
strptime((char*)sqlite3_column_text(stmt, i),
|
||||
"%Y-%m-%d %T", &t);
|
||||
- e->time_logged = mktime(&t);
|
||||
+ e->time_logged = timegm(&t);
|
||||
}
|
||||
else if (!strcmp(name, "time_event")) {
|
||||
strptime((char*)sqlite3_column_text(stmt, i),
|
||||
"%Y-%m-%d %T", &t);
|
||||
- e->time_event = mktime(&t);
|
||||
+ e->time_event = timegm(&t);
|
||||
}
|
||||
else if (!strcmp(name, "time_last_update")) {
|
||||
strptime((char*)sqlite3_column_text(stmt, i),
|
||||
"%Y-%m-%d %T", &t);
|
||||
- e->time_last_update = mktime(&t);
|
||||
+ e->time_last_update = timegm(&t);
|
||||
}
|
||||
else if (!strcmp(name, "type"))
|
||||
e->type = sqlite3_column_int(stmt, i);
|
||||
--
|
||||
2.51.0
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 23 09:13:17 UTC 2026 - Michal Suchanek <msuchanek@suse.de>
|
||||
|
||||
- Fix timezone handling (jsc#PED-14538)
|
||||
* libservicelog-Fix-timezone-handling-in-servicelog-ev.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Oct 26 15:11:01 UTC 2023 - Michal Suchanek <msuchanek@suse.com>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package libservicelog
|
||||
#
|
||||
# Copyright (c) 2023 SUSE LLC
|
||||
# Copyright (c) 2026 SUSE LLC and contributors
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@@ -35,6 +35,7 @@ Source0: https://github.com/power-ras/libservicelog/archive/v%{version}.t
|
||||
Source1: baselibs.conf
|
||||
Source2: libservicelog-rpmlintrc
|
||||
Source3: system-group-service.conf
|
||||
Patch1: libservicelog-Fix-timezone-handling-in-servicelog-ev.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: librtas-devel
|
||||
|
||||
Reference in New Issue
Block a user