Programing - C/C Basic grammar
127 1/1000초 구하기 (_ftime)
junmoyo
2018. 1. 10. 00:29
개념 :
1. 원형 : void _ftime(struct _timeb *timeptr);
2. 구조체 :
struct _timeb
{
time_t time; //time_t
unsigned short; millitm // 1/1000초
short timezone; //세계 표준시와 현지와의 분수의 차이
short dstflag; //써머타임 적용 시 0이 아닌 값, 그밖에는 0
};
소스코드 : main.c
#include <stdio.h>
#include <time.h>
#include <sys/timeb.h>
#include <memory.h>
int main(int argc, const char * argv[])
{
struct timeb tb; // _timeb use windows
struct tm t;
ftime(&tb); // _ftime use windows
t= *localtime(&tb.time);
printf("현재 날짜 및 시간 : %4d. %d. %d. %d. %d. %d. %d \n",t.tm_year+1900, t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t. tm_sec, tb.millitm);
return 0;
}
결과: