Code:
File start : 128 (0x0080)
File size : 18144 bytes
File name : DR_FORCE_00
File comment : Gongos2931
File minutes : 15918765
Save date : Wed Apr 07 16:45:00 2010 //ctime()
Save date : Wednesday April 07, 2010; 04:45PM //strftime()
First block #: 3
Last block #: 315
Gross Blocks : 313
Net Blocks : 284
File start : 20224 (0x4F00)
File size : 148 bytes
File name : OASIS2__SYS
File comment : Config.
File minutes : 14670330
Save date : Thu Nov 22 16:30:00 2007 //ctime()
Save date : Thursday November 22, 2007; 04:30PM //strftime()
First block #: 317
Last block #: 319
Gross Blocks : 3
Net Blocks : 3
File start : 20480 (0x5000)
File size : 696 bytes
File name : OASIS2_SVD0
File comment : PLAY DATA
File minutes : 14670332
Save date : Thu Nov 22 17:32:00 2007 //ctime()
Save date : Thursday November 22, 2007; 05:32PM //strftime()
First block #: 321
Last block #: 332
Gross Blocks : 12
Net Blocks : 12
File minutes is the figure being used. The two Save date lines are the resulting output.
This is the structure in the time.h file on my system.
Code:
/*
* A structure for storing all kinds of useful information about the
* current (or another) time.
*/
struct tm
{
int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */
int tm_min; /* Minutes: 0-59 */
int tm_hour; /* Hours since midnight: 0-23 */
int tm_mday; /* Day of the month: 1-31 */
int tm_mon; /* Months *since* january: 0-11 */
int tm_year; /* Years since 1900 */
int tm_wday; /* Days since Sunday (0-6) */
int tm_yday; /* Days since Jan. 1: 0-365 */
int tm_isdst; /* +1 Daylight Savings Time, 0 No DST,
* -1 don't know */
};
This is the function being used.
Code:
time_t gameSaveDate(const int fileMinutes)
{
struct tm segaEpoch;
segaEpoch.tm_sec = 0;
segaEpoch.tm_min = fileMinutes;
segaEpoch.tm_hour = 0;
segaEpoch.tm_mday = 1;
segaEpoch.tm_mon = 0;
segaEpoch.tm_year = 80;
return mktime(&segaEpoch);
}
Using the debugger, I'm seeing that the values being returned by mktime are 62 minutes worth of seconds apart.
Am I doing something wrong somewhere?
Originally Posted by
oogabooga
Your "off by an hour" problem is probably because you haven't set tm_isdst. Try setting it to -1.
I just set it to -1 right now to see what would happen, and the time is correct now. But I'm confused because why would that matter with back-to-back function calls for times that are 2 minutes apart on the same day? It's correct for the first one, wrong for the second one, and correct for the third one. That boggles me.