clock 설명 경과된 clock tick 의 시간을 돌려준다. 문법 #include<time.h> clock_t clock(void) 기능 두 이벤트 사이에 경과된 시간을 체크하고자 할 때 사용한다. 초당 클릭틱 수는 time.h에 정의되어져 있다. ( VC++6.0 의 경우 : #define CLOCKS_PER_SEC 1000 되어 있다 ) ( TC 3.0 의 경우 #define CLOCKS_PER_SEC 18.2 ) 리턴값 경과된 시간을 돌려주고 실패하면:-1을 …
asctime 설명 구조체에 담긴 시간 값을 문자열화시켜 돌려줍니다. 문법 #include<time.h> char *asctime(const struct tm *timeptr); 기능 구조체 안에 들어가 있는 시간값을 asctime 을 이용하여 문자값으로 변환시켜준다. 리턴값 날짜와 시간을 포함하는 문자열 포인터를 리턴한다. 시간 구조체 struct tm { int tm_sec; /* seconds */ 초(0-59) int tm_min; /* minut…
time 설명 시간을 얻는다 문법 #include<time.h> time_t time(time_t *timer); 기능 time_t형 변수에 1970년 1월 1일 00시 00분 00초를 GMT 기준으로하여 현재 시스템의 년,월,일, 시, 분,초까지 경과된 시간을 초 단위로 환산하여 돌려줍니다. 리턴값 초단위로 리턴 사용법 #include <stdio.h> #include <time.h> main() { time_t t; t = time(…
difftime 설명 time0 과 time1 을 뺀 시간값을 계산해준다. 문법 #include<time.h> double difftime(time_t time1,time_t time0); 기능 time1에서 time0를 뺀 시간를 돌려주는 함수입니다. 리턴값 실수값으로 시간값을 리턴해준다. 사용법 #include<stdio.h> #include<conio.h> #include<time.h> int main( ) { time_t a…
gmtime 설명 현재 시스템의 시간을 기준으로 영국 그리니치 표준시간을 얻어서 돌려줍니다. 문법 #include<time.h> struct tm *gmtime(const time_t *timer); 기능 출력된 시간은 영국시간이므로 우리보다 9 시간 늦은 시간이 표시 될것입니다. 리턴값 분할된 시간이 저장된 구조체의 포인터를 반환한다. 시간 구조체 struct tm { int tm_sec; /* seconds */ 초(0-59) int tm_min…
localtime 설명 날짜와 시간을 구조체로 변경한다 문법 #include<time.h> struct tm *localtime(const time_t *timer); 기능 time 함수에서 시간을 구하여 구조체 tm 에 저장한다 리턴값 time 함수가 구한 시간을 구조체 형식으로 바꿔 번지를 리턴한다. 시간 구조체 struct tm { int tm_sec; /* seconds */ 초(0-59) int tm_min; /* minutes */ 분(0-…
ftime 설명 timeb 구조체에 현재 시간을 저장한다. 문법 #include<sys/timeb.h> void ftime(struct timeb *buf); 기능 ftime은 현재 시간을 결정하고 buf가 가르키는 timeb 구조체에의 항목에 값들을 저장한다. 리턴값 없음 struct timeb { long time; 1970/1/1 이후 경과초을 GMT 시간을로 가진다. short millitm; 10…
stime 설명 시스템 날짜와 시간을 바꿔준다. 문법 #include<time.h> int stime(time_t *tp); 기능 stime은 시스템 시간과 날짜를 설정하며 tp는 1970년 1월 일 00 : 00 : 00 GMT 로부터 초 단위로 측정된 시간의 값을 가리킨다. 리턴값 무조건 0 으로 리턴한다. 24시간 이전시간으로 세팅한다. 사용법 #include <stdio.h> #include <time.h> main(){ time_…
sleep() 설명 sleep() 함수 다음에 출력되는 문장(소리) 등을 해당 시간만큼 지연시킨다.. 문법 #include<dos.h> sleep(unsigned seconds) 기능 sleep() 함수 이후로 생성되는 것은 해당 시간(초) 만큼 지연시킨다. 리턴값 없음 사용법 #include<stdio.h> #include<dos.h> main(void) { sleep(1000); printf("첫번째 "); sleep(…
시간이란것을 모르시는분들 없으시겠죠? 자 그럼 컴퓨터의 시간함수에 대해서 알아보아요. 우선 시간을 나타내려면 헤더파일을 포함해야된다. #include <time.h> 아주 중요하죠 없으면 아무것도 못하죠 ^^;; 그다음에 현재 시간을 구하는 time 사용하여 시간을 나타내보자 time_t time(time_t *t); time 함수는 1970 년 1 월 1일 00시 00분을 기준으로 현재까지의 시간을 초로 나타내어준다. #include<stdio.h> #include<time.h> …