Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
701 B
2
Indexable
Never
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <iostream>
#include <string>
#include <time.h>

using namespace std;

void tidsKalk(const int sekund);



int main() {
	
		double seconds, days;
		time_t currentDate;
		struct tm* Christmas, today;

		time(&currentDate);

		today = *localtime(&currentDate);

		Christmas = localtime(&currentDate);
		Christmas->tm_mon = 11; // 0 == January, 11 == December
		Christmas->tm_mday = 25;
		if (today.tm_mday > 25 && today.tm_mon == 11)
			Christmas->tm_year = today.tm_year + 1;

		seconds = difftime(mktime(Christmas), currentDate);
		days = seconds / 86400;

		printf("%g days\n", days);

		return 0;
	
}