#include <time.h>
#include <sys/types.h>
#include <stdio.h>
int main()
{
struct tm *mytm;
// 현재의 Unix Time 을 얻어온다.
time_t current_time = time((time_t*)NULL);
// Unix Time 을 이용해서 tm 구조체를 채운다.
mytm = localtime(¤t_time);
// asctime 를 이용해서 보기쉬운 문자열로 변환한다.
printf("%s", asctime(mytm));
return 0;
}
1장. asctime(3)
시간을 (사람이)읽기 쉬운형태로 되돌려준다.
1.1절. 사용법
1.2절. 설명
timeptr구조체를 체워서 입력하면, 해당시간을 사람이 이해하기 쉬운 문자열로 되돌려준다.
1.3절. 반환값
ctime(3) 과 동일한 포맷으로 해당 시간을 표시한 문자열에 대한 포인터를 되돌려준다.
1.4절. 예제
Recent Posts
Archive Posts
Tags