Zjištění času spuštění vlastního procesu ve Windows.
#include <stdio.h> #include <windows.h> #include <locale.h> #include <assert.h> int main() { _wsetlocale(LC_ALL, L"Czech"); FILETIME ft_vytvoreni; FILETIME filetime; FILETIME ft_konec; FILETIME ft_kernel; FILETIME ft_user; HANDLE h_proces = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, GetCurrentProcessId()); if (GetProcessTimes(h_proces, &ft_vytvoreni, &ft_konec, &ft_kernel, &ft_user)) { SYSTEMTIME st; if (FileTimeToLocalFileTime(&ft_vytvoreni, &filetime)) if (FileTimeToSystemTime(&filetime, &st)) wprintf(L"Proces spuštěn v %d.%d.%d %.2d:%.2d:%.2d\n", st.wDay, st.wMonth, st.wYear, st.wHour, st.wMinute, st.wSecond); CloseHandle(h_proces); } else { CloseHandle(h_proces); return EXIT_FAILURE; } printf("\nhotovo\n"); getchar(); return EXIT_SUCCESS; }