Skip to content

Commit

Permalink
test_physfs's "stat" command now respects unknown file times (-1).
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 23, 2012
1 parent a6ff95c commit c306437
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions test/test_physfs.c
Expand Up @@ -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 */
Expand Down

0 comments on commit c306437

Please sign in to comment.