summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-02-15 13:40:00 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-02-15 13:40:00 +0100
commitbae7e97a445e99899ca3fcb614dbc45d924bac26 (patch)
tree70dc2bba67697793992c69312c2f47bc764add1d
parenta1517dd205b46841d7317123dc1c0495ad48599b (diff)
parentdc7278afe5a882bef1800e9aecf7acacb6257e94 (diff)
downloadpsutil-bae7e97a445e99899ca3fcb614dbc45d924bac26.tar.gz
Merge branch 'master' of github.com:giampaolo/psutil
-rw-r--r--HISTORY.rst4
-rw-r--r--psutil/_psutil_linux.c2
-rw-r--r--psutil/_psutil_windows.c16
3 files changed, 9 insertions, 13 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 7341b6d7..52b46f7f 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -18,8 +18,8 @@ XXXX-XX-XX
raising AccessDenied).
- 1679_: [Windows] net_connections() and Process.connections() are 10% faster.
- 1686_: [Windows] added support for PyPy on Windows.
-- 1693_: [Windows] boot_time() and Process.create_time() now have the precision
- of a micro second (before the precision was of a second).
+- 1693_: [Windows] boot_time(), Process.create_time() and users()'s login time
+ now have 1 micro second precision (before the precision was of 1 second).
**Bug fixes**
diff --git a/psutil/_psutil_linux.c b/psutil/_psutil_linux.c
index ec8b433a..915ab9b4 100644
--- a/psutil/_psutil_linux.c
+++ b/psutil/_psutil_linux.c
@@ -548,7 +548,7 @@ error:
static PyMethodDef mod_methods[] = {
// --- per-process functions
-#ifdef PSUTIL_HAVE_IOPRIO
+#if PSUTIL_HAVE_IOPRIO
{"proc_ioprio_get", psutil_proc_ioprio_get, METH_VARARGS,
"Get process I/O priority"},
{"proc_ioprio_set", psutil_proc_ioprio_set, METH_VARARGS,
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c
index 109ed6c5..82fa518e 100644
--- a/psutil/_psutil_windows.c
+++ b/psutil/_psutil_windows.c
@@ -1195,7 +1195,6 @@ psutil_users(PyObject *self, PyObject *args) {
DWORD bytes;
PWTS_CLIENT_ADDRESS address;
char address_str[50];
- long long unix_time;
WINSTATION_INFO station_info;
ULONG returnLen;
PyObject *py_tuple = NULL;
@@ -1271,18 +1270,15 @@ psutil_users(PyObject *self, PyObject *args) {
goto error;
}
- unix_time = ((LONGLONG)station_info.ConnectTime.dwHighDateTime) << 32;
- unix_time += \
- station_info.ConnectTime.dwLowDateTime - 116444736000000000LL;
- unix_time /= 10000000;
-
py_username = PyUnicode_FromWideChar(buffer_user, wcslen(buffer_user));
if (py_username == NULL)
goto error;
- py_tuple = Py_BuildValue("OOd",
- py_username,
- py_address,
- (double)unix_time);
+ py_tuple = Py_BuildValue(
+ "OOd",
+ py_username,
+ py_address,
+ psutil_FiletimeToUnixTime(station_info.ConnectTime)
+ );
if (!py_tuple)
goto error;
if (PyList_Append(py_retlist, py_tuple))