In a custom savegame menu, I am trying to display the modification time of my gamesave files, but the time stamps obtained with the code below are all in 2004.04.08 instead of the current date on PSP.
The same code gives the expected results on Linux however, and when converting the time_t struct returned by time(NULL) on PSP, I also get the current date as expected.
I checked that I also see the proper creation & modification time for my files when accessing them through USB.
It all looks as if the st_#time attributes of the stat struct on PSP are set to a different time origin or something...
Am I doing something wrong here?
Code: Select all
char save_list[NB_SAVEGAMES][20];
void create_savegame_list()
{
int i;
char save_name[] = "game_00.sav";
struct stat buffer;
struct tm* t;
for (i=0; i<NB_SAVEGAMES; i++)
{
sprintf(save_name, "game_%02d.sav", i+1);
if (stat(save_name, &buffer))
{
sprintf(save_list[i], "<EMPTY SLOT>");
}
else
{
t = localtime(&buffer.st_mtime);
sprintf(save_list[i], "%04d.%02d.%02d %02d:%02d:%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday,
t->tm_hour, t->tm_min, t->tm_sec);
}
}
}