File fix-filesystime.patch of Package uae-test
Fix conversion of Amiga DateStamp to UNIX time
It would be necessary to determine DST at the specified time,
NOT at the current time. But it's easier to just set -1 as tm_isdst,
then mktime() will figure it out correctly itself.
diff -ur e-uae-0.8.29-20080820/src/filesys.c e-uae-0.8.29-20080820.new/src/filesys.c
--- e-uae-0.8.29-20080820/src/filesys.c
+++ e-uae-0.8.29-20080820.new/src/filesys.c
@@ -1963,19 +1963,15 @@
# if defined HAVE_GMTIME_R && defined HAVE_LOCALTIME_R
{
struct tm tm;
- struct tm now_tm;
- time_t now_t;
gmtime_r (&t, &tm);
/*
* tm now contains the desired time in local time zone, not taking account
- * of DST. To fix this, we determine if DST is in effect now and stuff that
- * into tm.
+ * of DST. To fix this, we set tm_isdst to -1 to let mktime() figure out
+ * whether DST is active at the specified time or not.
*/
- now_t = time (0);
- localtime_r (&now_t, &now_tm);
- tm.tm_isdst = now_tm.tm_isdst;
+ tm.tm_isdst = -1;
/* Convert time to UTC in seconds since the Unix epoch */
t = mktime (&tm);