- #include < ctime >
- #include <sys/time.h>
- struct timeval tv;
- char buf2[64];
- gettimeofday(&tv, NULL);
- char buf[128] = {0};
- strftime(buf2, sizeof (buf)-1, “%Y%m%d%H%M%S”, localtime (&tv.tv_sec));
- sprintf(buf, “%s.%02d”, buf2, (int)(tv.tv_usec / 1000/10));
- string Time(buf);
- char msdate[10];
- char msh[3];
- char msm[3];
- char mss[3];
- char msms[3];
- string DateTime;
- sprintf(msdate,”%02d”,Date);
- DateTime. append (msdate);
- sprintf(msh,”%02d”,Hour);
- DateTime.append(msh);
- sprintf(msm,”%02d”, Minute );
- DateTime.append(msm);
- sprintf(mss,”%02d”,.Second);
- DateTime.append(mss);
YYYYMMDDTHHMMSSSS