Mktime appears to return a value that is 3600 too low.
gcc (GCC) 3.2.3 (mingw special 20030504-1)
When the following code is compiled and run:
int main(int argc, char **argv)
struct tm tms;
tms.tm_year = 70; /* 1970 */
tms.tm_mon = 0; /* January */
tms.tm_mday = 1; /* 1st of */
tms.tm_hour = 10; /* 10 am exactly */
tms.tm_min = 0;
tms.tm_sec = 0;
tms.tm_isdst = 0;
time_in_secs = mktime(&tms);
The value output is 32400, whereas it should be 36000
(10 hours of 3600 seconds).
The machine is running in the Paris Timezone, DST set
(ie is currently at GMT + 2 hours) but mktime should
ignore this is give me the second count for the time I
have given it (10 hours after time zero). Incidentally,
if I set tm_isdst to 1, the output changes to 28800 or
8 hours rather than the 9 hours it should then report.
I have put this as runtime, but I may be wrong! Maybe I
should have put it in another category.
Log in to post a comment.