File A0006-Fix-timezone-bound-date-time-conversion.patch of Package libplist.4095
From 56cd0e80dd7c812ae6f55e8fa8190a439c1ddf47 Mon Sep 17 00:00:00 2001
From: Nikias Bassen <nikias@gmx.li>
Date: Tue, 1 Apr 2014 17:37:13 +0200
Subject: [PATCH] xplist: Fix timezone-bound date/time conversion
---
src/xplist.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/xplist.c b/src/xplist.c
index 653cf49..405a844 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -223,7 +223,7 @@ static void node_to_xml(node_t* node, void *xml_struct)
tag = XPLIST_DATE;
{
time_t time = (time_t)node_data->timeval.tv_sec;
- struct tm *btime = localtime(&time);
+ struct tm *btime = gmtime(&time);
if (btime) {
val = (char*)malloc(24);
memset(val, 0, 24);
@@ -398,8 +398,11 @@ static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node)
time_t time = 0;
if (strlen((const char*)strval) >= 11) {
struct tm btime;
+ struct tm* tm_utc;
parse_date((const char*)strval, &btime);
time = mktime(&btime);
+ tm_utc = gmtime(&time);
+ time -= (mktime(tm_utc) - time);
}
data->timeval.tv_sec = (long)time;
data->timeval.tv_usec = 0;