From cc9170147ceded9e8bc3cb5bb008e6a4cf32c1e7 Mon Sep 17 00:00:00 2001 From: Marcus Furlong Date: Thu, 23 Jul 2015 13:53:19 +1000 Subject: [PATCH] Add support for cygwin --- monotonic.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/monotonic.py b/monotonic.py index afff9b4..896f09b 100644 --- a/monotonic.py +++ b/monotonic.py @@ -96,6 +96,16 @@ except AttributeError: """Monotonic clock, cannot go backward.""" return GetTickCount64() / 1000.0 + elif sys.platform.startswith('cygwin'): + # Cygwin + kernel32 = ctypes.cdll.LoadLibrary('kernel32.dll') + GetTickCount64 = kernel32.GetTickCount64 + GetTickCount64.restype = ctypes.c_ulonglong + + def monotonic(): + """Monotonic clock, cannot go backward.""" + return GetTickCount64() / 1000.0 + else: try: clock_gettime = ctypes.CDLL(ctypes.util.find_library('c'),