summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-19 16:04:14 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2019-02-19 16:04:14 -0800
commit8e2c4b1644053e4e317a99e6d31070de093e57be (patch)
tree47244477c50a87bb8596516a1fe4478d0f3e414d
parentae1d2114cf3d13fb92926a5ee1d46150fffb400b (diff)
downloadpsutil-8e2c4b1644053e4e317a99e6d31070de093e57be.tar.gz
port GetTickCount64
-rw-r--r--psutil/_psutil_windows.c4
-rw-r--r--psutil/arch/windows/global.h4
2 files changed, 4 insertions, 4 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 17e6305f..12234a54 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -239,8 +239,6 @@ psutil_get_num_cpus(int fail_on_err) {
static PyObject *TimeoutExpired;
static PyObject *TimeoutAbandoned;
-static ULONGLONG (*psutil_GetTickCount64)(void) = NULL;
-
/*
* Return a Python float representing the system uptime expressed in seconds
* since the epoch.
@@ -255,7 +253,6 @@ psutil_boot_time(PyObject *self, PyObject *args) {
time_t pt;
FILETIME fileTime;
long long ll;
- psutil_GetTickCount64;
GetSystemTimeAsFileTime(&fileTime);
/*
@@ -284,7 +281,6 @@ psutil_boot_time(PyObject *self, PyObject *args) {
// "#if (_WIN32_WINNT >= 0x0600)" pre-processor but that way
// the produced exe/wheels cannot be used on Windows XP, see:
// https://github.com/giampaolo/psutil/issues/811#issuecomment-230639178
- psutil_GetTickCount64 = psutil_GetProcAddress("kernel32", "GetTickCount64");
if (psutil_GetTickCount64 != NULL) {
// Windows >= Vista
uptime = psutil_GetTickCount64() / (ULONGLONG)1000.00f;
diff --git a/psutil/arch/windows/global.h b/psutil/arch/windows/global.h
index 9bf119b6..7976d1ba 100644
--- a/psutil/arch/windows/global.h
+++ b/psutil/arch/windows/global.h
@@ -11,6 +11,7 @@ typedef PSTR (NTAPI * _RtlIpv4AddressToStringA)(struct in_addr *, PSTR);
typedef PSTR (NTAPI * _RtlIpv6AddressToStringA)(struct in6_addr *, PSTR);
typedef DWORD (_stdcall * NTQSI_PROC) (int, PVOID, ULONG, PULONG);
typedef DWORD (CALLBACK *_GetActiveProcessorCount)(WORD);
+typedef ULONGLONG (CALLBACK *_GetTickCount64)(void);
_RtlIpv4AddressToStringA \
@@ -34,4 +35,7 @@ _GetActiveProcessorCount \
PWINSTATIONQUERYINFORMATIONW \
psutil_WinStationQueryInformationW;
+_GetTickCount64 \
+ psutil_GetTickCount64;
+
int psutil_load_globals();