1
我的代碼中使用了time_t和Struct tm。我無法像我正在做的那樣初始化結構體。如果這是在函數中初始化,那麼它工作正常。請幫助編譯時的time_t聲明問題
#include "time.h"
static struct tm strtime;
struct tm * timeinfo;
time_t startTime;
time_t endTime;
time_t curTime;
time_t candleStartTime;
strtime.tm_hour = 9; //Error here
strtime.tm_min = 15; //Error here
strtime.tm_sec = 00; //Error here
void PrintMarketData(void **args,nsString sPfName)
{
curTime = time (NULL);
timeinfo = localtime (&curTime);
int curYear = timeinfo->tm_year;
int curMonth = timeinfo->tm_mon;
int curDay = timeinfo->tm_mday;
strtime.tm_year = curYear;
strtime.tm_mon = curMonth;
strtime.tm_mday = curDay;
}
'struct'成員訂單總是標準化的。 – Potatoswatter