test_physfs's "stat" command now respects unknown file times (-1).

This commit is contained in:
Ryan C. Gordon 2012-03-23 03:30:16 -04:00
parent a6ff95c6aa
commit c306437ece
1 changed files with 9 additions and 3 deletions

View File

@ -1031,9 +1031,15 @@ static int cmd_write(char *args)
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 */