4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 11:30:56 +08:00

default ps -W process start time to system boot time when inaccessible, 0, -1

This commit is contained in:
Brian Inglis 2019-03-23 20:22:38 -06:00 committed by Corinna Vinschen
parent 5737045c00
commit ee1ad64234

View File

@ -337,6 +337,17 @@ main (int argc, char *argv[])
p->start_time = to_time_t (&ct);
CloseHandle (h);
}
if (!h || 0 == p->start_time || -1 == p->start_time)
{
SYSTEM_TIMEOFDAY_INFORMATION stodi;
status = NtQuerySystemInformation (SystemTimeOfDayInformation,
(PVOID) &stodi, sizeof stodi, NULL);
if (!NT_SUCCESS (status))
fprintf (stderr,
"NtQuerySystemInformation(SystemTimeOfDayInformation), "
"status %08x", status);
p->start_time = to_time_t ((FILETIME*)&stodi.BootTime);
}
}
char uname[128];