2014. 1. 22. 14:09
#include<stdio.h>
#include<time.h>
struct tms
{
int tm_sec;
int tm_min;
int tm_hour;
int tm_mday;
int tm_mon;
int tm_year;
int tm_wday;
int tm_yday;
int tm_isdst;
};
void main(void)
{
char today[100];
time_t t;
struct tms *gmp, *lcp;
int i;
memset(today, '\0', sizeof(today));
t = time(NULL);
lcp = localtime(&t);
printf("현재시간 -> %d:%d:%d\n현재날짜 -> %d년 %d월 %d일 ", lcp->tm_hour, lcp->tm_min, lcp->tm_sec, lcp->tm_year+1900,lcp->tm_mon+1, lcp->tm_mday);
printf("\n");
sprintf(today, "%d/%.2d/%.2d %d:%.2d:%.2d\n", lcp->tm_year+1900, lcp->tm_mon+1, lcp->tm_mday, lcp->tm_hour, lcp->tm_min, lcp->tm_sec);
printf("Today : %s\n", today);
}
'OLD - 일 > Linux' 카테고리의 다른 글
Linux - 오늘 작업현황 (0) | 2014.01.28 |
---|---|
Linux - TCP/IP 통신 1차완성 (1) | 2014.01.23 |
etc] Linux - TCP/IP echo src (0) | 2014.01.20 |
Linux - TCP/IP echo Client src (0) | 2014.01.20 |
Linux - TCP/IP echo Server src (0) | 2014.01.20 |