使用visual studio 2013,创建一个标准的win32控制台应用程序,无论传递的params如何,mktime都会返回负数(-1)。
这段代码是否应该以这种方式失败?我不知道通过tm params的任何组合会产生任何不同。
#include "stdafx.h"
#include <time.h>
int _tmain(int argc, _TCHAR* argv[])
{
struct tm stm;
stm.tm_sec = 27;
stm.tm_min = 5;
stm.tm_hour = 18;
stm.tm_mday = 2;
stm.tm_mon = 1;
stm.tm_year = 2015;
stm.tm_wday = 0;
stm.tm_yday = 0;
printf("%lld\n", mktime(&stm));//prints -1
return 0;
}