From 1534ba52e17982256b903604fd10a9b9023519bd Mon Sep 17 00:00:00 2001 From: Jan Bodnar Date: Mon, 1 Feb 2016 13:41:07 +0100 Subject: [PATCH] Create arithmetic.c --- datetime/arithmetic.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 datetime/arithmetic.c diff --git a/datetime/arithmetic.c b/datetime/arithmetic.c new file mode 100644 index 0000000..3d75f8d --- /dev/null +++ b/datetime/arithmetic.c @@ -0,0 +1,30 @@ +#include +#include + +#define NSECS 60*60*3 + +int wmain(void) { + + SYSTEMTIME st = {0}; + FILETIME ft = {0}; + + GetLocalTime(&st); + + wprintf(L"%02d/%02d/%04d %02d:%02d:%02d\n", + st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond); + + SystemTimeToFileTime(&st, &ft); + + ULARGE_INTEGER u = {0}; + + memcpy(&u, &ft, sizeof(u)); + u.QuadPart += NSECS * 10000000LLU; + memcpy(&ft, &u, sizeof(ft)); + + FileTimeToSystemTime(&ft, &st); + + wprintf(L"%02d/%02d/%04d %02d:%02d:%02d\n", + st.wDay,st.wMonth,st.wYear,st.wHour,st.wMinute,st.wSecond); + + return 0; +}