[uae] Clock fixes

  • From: Richard Drummond <evilrich@xxxxxxxxxxxxxx>
  • To: uae@xxxxxxxxxxxxx
  • Date: Wed, 28 Jul 2004 01:34:12 -0500

Hi All

Attached is a patch which should fix the time-stamp problems with the virtual 
filesystem. I've haven't committed this to CVS yet, because I first need to 
verify how portable this fix is.

You can find a binary for Linux/x86 with this patch applied and also Toni's 
fixes for the clock sychronization function at
http://www.rcdrummond.net/uae/test/uae-linux-i386-clock-fix.bz2

This should fix the problem with YAM regenerating folder indices.

Cheers,
Rich
Index: filesys.c
===================================================================
RCS file: /cvsroot/uaedev/uae/src/filesys.c,v
retrieving revision 1.4
diff -u -r1.4 filesys.c
--- filesys.c   12 Jul 2004 18:08:23 -0000      1.4
+++ filesys.c   28 Jul 2004 06:28:38 -0000
@@ -386,8 +386,12 @@
     mountinfo->num_units++;
     retval = set_filesys_unit_1 (mountinfo, nr, devname, volname, rootdir, 
readonly,
                                 secspertrack, surfaces, reserved, blocksize, 
bootpri, filesysdir);
-    if (retval)
+
+    if (retval) {
+        write_log ("%s\n", retval);
        mountinfo->num_units--;
+    }
+
     return retval;
 }
 
@@ -1878,6 +1882,11 @@
     /* mins since midnight */
     /* ticks past minute @ 50Hz */
 
+    struct tm tm;
+
+    localtime_r (&t, &tm);
+    t = timegm (&tm);
+
     t -= diff;
     *days = t / secs_per_day;
     t -= *days * secs_per_day;
@@ -1889,13 +1898,16 @@
 static time_t
 put_time (long days, long mins, long ticks)
 {
-    time_t t;
-    t = ticks / 50;
-    t += mins * 60;
-    t += days * secs_per_day;
-    t += diff;
+    struct tm tm;
+
+    tm.tm_sec  = ticks / 50;
+    tm.tm_min  = mins;
+    tm.tm_hour = 0;
+    tm.tm_mday = days;
+    tm.tm_mon  = 0;
+    tm.tm_year = 78;
 
-    return t;
+    return mktime (&tm);
 }
 
 static void free_exkey (Unit *unit, ExamineKey *ek)

Other related posts: