Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Inglis <Brian.Inglis@SystematicSW.ab.ca>2019-03-24 05:22:38 +0300
committerCorinna Vinschen <corinna@vinschen.de>2019-03-25 13:26:17 +0300
commitee1ad64234b61f9deaae64b28313492188c1de43 (patch)
tree664cb09487505685052951c05a273beb5a902633
parent5737045c00db0cf9462b556bf56fbfa15c9ba90c (diff)
default ps -W process start time to system boot time when inaccessible, 0, -1
-rw-r--r--winsup/utils/ps.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/utils/ps.cc b/winsup/utils/ps.cc
index 4fce3e0b3..c81805ab6 100644
--- a/winsup/utils/ps.cc
+++ b/winsup/utils/ps.cc
@@ -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];