dev/c/datetime_test/datetime_test.c
Kolan Sh ebb76185ad datetime_test
--HG--
rename : c/timeconv_test/Makefile => c/datetime_test/Makefile
2011-12-09 14:21:20 +03:00

35 lines
472 B
C

#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "datetime.h"
int main(int argc, char *argv[])
{
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;
putenv("TZ=GMT+0");
tt = mktime(&tm);
memset(&tm, 0, sizeof(tm));
tm = *gmtime(&tt);
strftime(buf, sizeof(buf), "%Y.%m.%d %H.%M.%S", &tm);
puts(buf);
return 0;
}