[Gamecube/Wii] fixed one-month offset in state/sram file displayed date

This commit is contained in:
ekeeke 2021-04-08 16:04:20 +02:00
parent 4aa6e9d89e
commit cea418ece8
4 changed files with 7 additions and 7 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 MiB

After

Width:  |  Height:  |  Size: 4.0 MiB

View File

@ -3,7 +3,7 @@
* *
* FAT and Memory Card SRAM/State slots managment * FAT and Memory Card SRAM/State slots managment
* *
* Copyright Eke-Eke (2008-2014), based on original code from Softdev (2006) * Copyright Eke-Eke (2008-2021), based on original code from Softdev (2006)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met:
@ -288,11 +288,11 @@ void slot_autodetect(int slot, int device, t_slot *ptr)
if (fp) if (fp)
{ {
/* Retrieve date & close */ /* Retrieve date & close */
struct stat filestat; struct stat filestat;
stat(filename, &filestat); stat(filename, &filestat);
struct tm *timeinfo = localtime(&filestat.st_mtime); struct tm *timeinfo = localtime(&filestat.st_mtime);
ptr->year = 1900 + timeinfo->tm_year; ptr->year = 1900 + timeinfo->tm_year;
ptr->month = timeinfo->tm_mon; ptr->month = timeinfo->tm_mon + 1;
ptr->day = timeinfo->tm_mday; ptr->day = timeinfo->tm_mday;
ptr->hour = timeinfo->tm_hour; ptr->hour = timeinfo->tm_hour;
ptr->min = timeinfo->tm_min; ptr->min = timeinfo->tm_min;
@ -326,9 +326,9 @@ void slot_autodetect(int slot, int device, t_slot *ptr)
card_stat CardStatus; card_stat CardStatus;
CARD_GetStatus(device, CardFile.filenum, &CardStatus); CARD_GetStatus(device, CardFile.filenum, &CardStatus);
time_t rawtime = CardStatus.time; time_t rawtime = CardStatus.time;
struct tm *timeinfo = localtime(&rawtime); struct tm *timeinfo = localtime(&rawtime);
ptr->year = 1900 + timeinfo->tm_year; ptr->year = 1900 + timeinfo->tm_year;
ptr->month = timeinfo->tm_mon; ptr->month = timeinfo->tm_mon + 1;
ptr->day = timeinfo->tm_mday; ptr->day = timeinfo->tm_mday;
ptr->hour = timeinfo->tm_hour; ptr->hour = timeinfo->tm_hour;
ptr->min = timeinfo->tm_min; ptr->min = timeinfo->tm_min;

View File

@ -3,7 +3,7 @@
* *
* FAT and Memory Card SRAM/Savestate files managment * FAT and Memory Card SRAM/Savestate files managment
* *
* Copyright Eke-Eke (2008-2014), based on original code from Softdev (2006) * Copyright Eke-Eke (2008-2021), based on original code from Softdev (2006)
* *
* Redistribution and use of this code or any derivative works are permitted * Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: * provided that the following conditions are met: