
Good evening, I thought about a solution to find the last boot time stamp (in seconds) which should work The only limitation is that on Win2003/XP and earlier it works if and only of the server is not running for more than 47 days. The trick is: * use a combination of GetTickCount(/GetTickCount64 to get the ms since last boot * Use GetSystemTime to get current system Time * Next, with some int64 magic, get the boot time by subtracting the elapsed boot time from current time * Next, go back to a SYSTEMTIME structure * As there are some different time functions involved, it seems that the ms part is no completely reliable, but the other members are do you think it may work ? here is a little sample: #include <windows.h> #include <stdio.h> int main() { SYSTEMTIME st; ULONGLONG tk; ULONGLONG now; FILETIME ft; ULONGLONG u_boot; FILETIME ft_boot; SYSTEMTIME st_boot; GetSystemTime(&st); //current time tk = GetTickCount(); //millisenconds since last boot SystemTimeToFileTime(&st,&ft); now = * ((ULONGLONG*) &ft); u_boot = (now / 10000 - tk) * 10000; //get a FILETIME back ft_boot = * ((FILETIME*) &u_boot); FileTimeToSystemTime(&ft_boot,&st_boot); printf("\nFunction Parameters"); printf("\n\tTick Count : %u",tk); printf("\n\tSystem Time to FileTime: %I64d", now); printf("\n\tBoot Time in 100ns : %I64d", u_boot); printf("\nBoot Time Was : %04d-%02d-%02d %02d:%02d:%02d.%03d", st_boot.wYear, st_boot.wMonth,st_boot.wDay, st_boot.wHour, st_boot.wMinute,st_boot.wSecond,st_boot.wMilliseconds); } Regards L. Trivelli