mirror of
https://github.com/janbodnar/Windows-API-examples.git
synced 2026-07-14 10:12:48 -04:00
Create arithmetic.c
This commit is contained in:
parent
e965a872b6
commit
1534ba52e1
30
datetime/arithmetic.c
Normal file
30
datetime/arithmetic.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include <windows.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user