// 시스템 ms 단위 시간 가져오기
void fnMakeTime(char* strTime){
char fmt[32];
char buf[32];
struct timeval tv;
struct tm *tm;
gettimeofday(&tv, NULL);
if((tm = localtime(&tv.tv_sec)) == NULL){
printf("localtime returns NULL\n");
sprintf(strTime, "%d", 0);
return;
}
strftime(fmt, sizeof(fmt), "%Y%m%d%H%M%S%%03u", tm);
sprintf(buf, fmt, tv.tv_usec/1000);
memcpy(strTime, buf, 18);
printf("fnMakeTime(%s)\n", strTime);
}
댓글 없음:
댓글 쓰기