diff --git a/psutil/_psutil_common.c b/psutil/_psutil_common.c index 890d515f6..1b83f7508 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 dd336489e..d5928d72c 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); }