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

#include "datetime.h"

void tz_test()
{
	struct tm tm;
	time_t tt;
	char buf[64];

	tm.tm_year = 2011 - 1900;
	tm.tm_mon = 12 - 1;
	tm.tm_mday = 9;
	tm.tm_hour = 15;
	tm.tm_min = 15;
	tm.tm_sec = 52;
	tm.tm_isdst = 0;

	tt = mktime(&tm) - timezone;

	memset(&tm, 0, sizeof(tm));

	tm = *gmtime(&tt);

	strftime(buf, sizeof(buf), "%Y.%m.%d %H.%M.%S", &tm);
	puts(buf);
}

void cs_test()
{
	struct datetime_cs dtcs;
	time_t tt;
	char buf[64];

	dtcs.tm.tm_year = 2011 - 1900;
	dtcs.tm.tm_mon = 12 - 1;
	dtcs.tm.tm_mday = 9;
	dtcs.tm.tm_hour = 15;
	dtcs.tm.tm_min = 15;
	dtcs.tm.tm_sec = 52;
	dtcs.tm.tm_isdst = 0;

	tt = mktime(&dtcs.tm) - timezone;

	memset(&dtcs.tm, 0, sizeof(dtcs.tm));

	dtcs.tm = *gmtime(&tt);

	strftime(buf, sizeof(buf), "%Y.%m.%d %H.%M.%S", &dtcs.tm);
	puts(buf);
}

int main(int argc, char *argv[])
{
	//tz_test();

	cs_test();

	return 0;
}

