cs_test()

This commit is contained in:
Kolan Sh 2011-12-09 16:09:36 +03:00
parent 4cadb48d74
commit ee2ff52879
1 changed files with 32 additions and 2 deletions

View File

@ -1,11 +1,10 @@
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "datetime.h"
int main(int argc, char *argv[])
void tz_test()
{
struct tm tm;
time_t tt;
@ -27,6 +26,37 @@ int main(int argc, char *argv[])
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;
}