Tag Archives: struct tm

[부사리]OC-struct tm – 4만초 후의 날짜 시간

[code] int main(int argc, const char * argv[]) { long secondsSince1970=time(NULL)+4000000; long someTimeLater=secondsSince1970; struct tm now; localtime_r(&secondsSince1970, &now); struct tm later; localtime_r(&someTimeLater, &later); // 현재시간출력 printf(“The current time was %d:%d:%d.n”,now.tm_hour, now.tm_min, now.tm_sec); // 오늘 날짜출력 printf(“The current date was %.2d-%.2d-%.4d.n”,1+(now.tm_mon),now.tm_mday, (now.tm_year)+1900); // 4만초 후의 날짜출력 printf(“The date in 4 million seconds will be %.2d-%.2d-%.2d,n”, (later.tm_mon)+1,… Read More »