summaryrefslogtreecommitdiffstats
path: root/Modules/socketmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-09-02 21:18:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-09-02 21:18:25 (GMT)
commitae58649721ec898ea4a101b0861e16fff3511cfa (patch)
treebb08b1a9b5f354212d7ca365d76659b09aed879a /Modules/socketmodule.c
parent9bb758cee7f1694807ebe600b6230fb8e565d3ea (diff)
downloadcpython-ae58649721ec898ea4a101b0861e16fff3511cfa.zip
cpython-ae58649721ec898ea4a101b0861e16fff3511cfa.tar.gz
cpython-ae58649721ec898ea4a101b0861e16fff3511cfa.tar.bz2
Issue #22043: time.monotonic() is now always available
threading.Lock.acquire(), threading.RLock.acquire() and socket operations now use a monotonic clock, instead of the system clock, when a timeout is used.
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r--Modules/socketmodule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index abadd8a..db69d6e 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -680,7 +680,7 @@ internal_select(PySocketSockObject *s, int writing)
double interval = s->sock_timeout; \
int has_timeout = s->sock_timeout > 0.0; \
if (has_timeout) { \
- _PyTime_gettimeofday(&now); \
+ _PyTime_monotonic(&now); \
deadline = now; \
_PyTime_ADD_SECONDS(deadline, s->sock_timeout); \
} \
@@ -691,7 +691,7 @@ internal_select(PySocketSockObject *s, int writing)
if (!has_timeout || \
(!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \
break; \
- _PyTime_gettimeofday(&now); \
+ _PyTime_monotonic(&now); \
interval = _PyTime_INTERVAL(now, deadline); \
} \
} \