如何在C ++中获取自月份开始以来的秒数?
我只是想知道如何思考这样一个问题的算法
我想我知道正确的方法,但我没有合适的工具来解决它
我已经采取过这种方式: time_t rawtime1, rawtime2; //Time type
struct tm * timeinfo; //Time structure
time(&rawtime1); //to Get current time
time(&rawtime2); //to Get current time
timeinfo = localtime(&rawtime2); //Convert time_t to tm as local time
//setting up in rawtime2 to the beggining of this specific month - like a reset to 0 in month and days
//now will convert rawtime2 to seconds with mktime
return rawtime1 - rawtime2;
感谢提前!!