mktime has problem with 00 year

Mohsen Pahlevanzadeh mohsen@pahlevanzadeh.org
Thu Jan 8 06:44:00 GMT 2015


Dear all,

mktime crach with 00 time : 1900 - 1900:
//////////////////////////////////////////////////////////
#include <stdio.h>
#include <time.h>

int
main(int argc, char ** argv)
{

     struct tm tm = {0};
     time_t t;

     tm.tm_year = 1900 - 1900;
     tm.tm_mon = 2;
     tm.tm_mday = 1;

     t = mktime(&tm);
     if ( t == -1 )
         printf ("mktime has been crashed!!!!");


}
/////////////////////////////

Do you have any solution?

--Regards,
Mohsen



More information about the Libc-help mailing list