test_physfs's "stat" command now respects unknown file times (-1).
authorRyan C. Gordon <icculus@icculus.org>
Fri, 23 Mar 2012 03:30:16 -0400
changeset 1263 3d5ed1d03b34
parent 1262 16276afbb026
child 1264 03715ba4603d
test_physfs's "stat" command now respects unknown file times (-1).
test/test_physfs.c
--- a/test/test_physfs.c	Fri Mar 23 03:29:48 2012 -0400
+++ b/test/test_physfs.c	Fri Mar 23 03:30:16 2012 -0400
@@ -1031,9 +1031,15 @@
 
 static char* modTimeToStr(PHYSFS_sint64 modtime, char *modstr, size_t strsize)
 {
-    time_t t = (time_t) modtime;
-    char *str = ctime(&t);
-    strncpy(modstr, str, strsize);
+    if (modtime < 0)
+        strncpy(modstr, "Unknown\n", strsize);
+    else
+    {
+        time_t t = (time_t) modtime;
+        char *str = ctime(&t);
+        strncpy(modstr, str, strsize);
+    } /* else */
+
     modstr[strsize-1] = '\0';
     return modstr;
 } /* modTimeToStr */