Today’s error series: undefined SYSTEMTIME

Today’s problem is relatively simple. Send it again and reinforce the impression of
today’s error report:
Error 1. The undefined SYSTEMTIME
is a very long number because the name of the existing screenshot file is set to pure seconds. It doesn’t seem to be clear at first glance. It’s more intuitive to change the file name to year, month, day, hour, minute, and second.
The first one is done, the task is completed today~
for example:

SYSTEMTIME nowTime;
GetLocalTime(&nowTime);
// 忽略语法,实际要正确用
nowTime.wYear;
nowTime.wMonth;
nowTime.wDay;

too young! ! !

Error: SYSTEMTIME is not defined!

After a little consideration, I realized that SYSTEMTIME is not the API of Windows. I used a ghost under Linux. I manually activated this thunder. I recognized it, and I won't commit it again in the future, Amen. . .

So specifically for Linux,
for example:

// 加头文件 
#include <time.h>

time_t timep;
struct tm *p;
time(&timep);
p = gmtime(&timep);
// 忽略语法,实际要正确用
p->tm_year;
p->tm_mon;
p->tm_mday

Then it is really solved. Although it is not time-consuming to solve the problem, it is very classic and worth recording.

Guess you like

Origin blog.51cto.com/15051869/2608332