[linux] - fix wrong local FileTime due to not honoring daylight savings time
authorvdrfan <vdrfan@xbmc.org>
Thu, 12 Sep 2013 16:36:15 +0000 (18:36 +0200)
committervdrfan <vdrfan@xbmc.org>
Thu, 12 Sep 2013 16:36:15 +0000 (18:36 +0200)
xbmc/linux/XTimeUtils.cpp

index ace71a0..1d4d99a 100644 (file)
@@ -83,7 +83,12 @@ BOOL FileTimeToLocalFileTime(const FILETIME* lpFileTime, LPFILETIME lpLocalFileT
   l.u.LowPart = lpFileTime->dwLowDateTime;
   l.u.HighPart = lpFileTime->dwHighDateTime;
 
-  l.QuadPart -= (uint64_t) timezone * 10000000;
+  time_t ft;
+  struct tm tm_ft;
+  FileTimeToTimeT(lpFileTime, &ft);
+  localtime_r(&ft, &tm_ft);
+
+  l.QuadPart += tm_ft.tm_gmtoff * 10000000;
 
   lpLocalFileTime->dwLowDateTime = l.u.LowPart;
   lpLocalFileTime->dwHighDateTime = l.u.HighPart;