Daniel Hrisca <daniel.hri...@gmail.com> added the comment:

I'm actually surprised that this problem gets so little interest. It's probably 
so obscure that most people don't even realize it.

Why isn't it implemented using winapi calls for the windows platform?

I took inspiration from this SO thread 
https://stackoverflow.com/questions/56502111/should-time-perf-counter-be-consistent-across-processes-in-python-on-windows
 
and came up with this function for 64 bit Python (a few more lines would be 
needed for error checking)

#include <windows.h>
static PyObject* perf_counter(PyObject* self, PyObject* args)
{
        PyObject* ret;

        QueryPerformanceFrequency(lpFrequency);
        QueryPerformanceCounter(lpPerformanceCount);
        
        ret = PyFloat_FromDouble(((double) lpPerformanceCount->QuadPart ) / 
lpFrequency->QuadPart);
        
        return ret;
}

----------
nosy: +danielhrisca

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37205>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to