Desc :

 

 


Source Code :

#include <stdio.h>
#include <time.h>

#define DAYSEC (24*60*60)

void main()
{
	time_t now;
	struct tm t, chrismas = {0,0,0,25,12,2021};
	int n1, n2, nChrismas;

	now = time(NULL);
	t = *localtime(&now);;

	chrismas.tm_year -= 1900;
	chrismas.tm_mon -= 1;

	t.tm_hour = 0;
	t.tm_min = 0;
	t.tm_sec = 0;

	n1 = mktime(&t);
	n2 = mktime(&chrismas);

	nChrismas = (n2 - n1);
	chrismas = *localtime(&nChrismas);
	
	printf("크리스마스까지 %d개월 %d일 남았습니다! \n"
		, chrismas.tm_mon , chrismas.tm_mday);
}

 


Result :

+ Recent posts