summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-01-11 10:46:23 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2020-01-11 10:46:23 -0800
commit4526fb11f18f361f4afc11484c768875e69de1a4 (patch)
tree9ec3756b7e723c45934259d5977062423a84a671
parent3880e3f88d886234b3a4347a7ae3479cbecc6aaa (diff)
downloadpsutil-4526fb11f18f361f4afc11484c768875e69de1a4.tar.gz
#1652: remove win XP code path checking avilability of GetTickCount64
-rw-r--r--psutil/_psutil_common.c14
-rw-r--r--psutil/_psutil_windows.c12
2 files changed, 9 insertions, 17 deletions
diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c
index 890d515f..1b83f750 100644
--- a/psutil/_psutil_common.c
+++ b/psutil/_psutil_common.c
@@ -281,14 +281,16 @@ psutil_loadlibs() {
"ntdll", "RtlNtStatusToDosErrorNoTeb");
if (! RtlNtStatusToDosErrorNoTeb)
return 1;
-
- // --- Optional
- // not available on Wine
- RtlIpv6AddressToStringA = psutil_GetProcAddressFromLib(
- "ntdll.dll", "RtlIpv6AddressToStringA");
- // minimum requirement: Win Vista
GetTickCount64 = psutil_GetProcAddress(
"kernel32", "GetTickCount64");
+ if (! GetTickCount64)
+ return 1;
+ RtlIpv6AddressToStringA = psutil_GetProcAddressFromLib(
+ "ntdll.dll", "RtlIpv6AddressToStringA");
+ if (! RtlIpv6AddressToStringA)
+ return 1;
+
+ // --- Optional
// minimum requirement: Win 7
GetActiveProcessorCount = psutil_GetProcAddress(
"kernel32", "GetActiveProcessorCount");
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index dd336489..d5928d72 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -101,17 +101,7 @@ psutil_boot_time(PyObject *self, PyObject *args) {
ll = (((ULONGLONG)
(fileTime.dwHighDateTime)) << 32) + fileTime.dwLowDateTime;
pt = (time_t)((ll - 116444736000000000ull) / 10000000ull);
-
- if (GetTickCount64 != NULL) {
- // Windows >= Vista
- uptime = GetTickCount64() / 1000ull;
- }
- else {
- // Windows XP.
- // GetTickCount() time will wrap around to zero if the
- // system is run continuously for 49.7 days.
- uptime = (ULONGLONG)GetTickCount() / 1000ull;
- }
+ uptime = GetTickCount64() / 1000ull;
return Py_BuildValue("K", pt - uptime);
}