]> granicus.if.org Git - python/commitdiff
Issue #21038: Use monotonic clock to compute timeout, not the system clock
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 25 Mar 2014 11:50:50 +0000 (12:50 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 25 Mar 2014 11:50:50 +0000 (12:50 +0100)
Lib/test/test_epoll.py

index d8af841efc452356b25589df811129d63a708e25..b37f033bf8f3042b0d7bda5b3045d4d8a97da728 100644 (file)
@@ -163,9 +163,9 @@ class TestEPoll(unittest.TestCase):
         ep.register(client.fileno(),
                    select.EPOLLIN | select.EPOLLOUT | select.EPOLLET)
 
-        now = time.time()
+        now = time.monotonic()
         events = ep.poll(1, 4)
-        then = time.time()
+        then = time.monotonic()
         self.assertFalse(then - now > 0.1, then - now)
 
         events.sort()
@@ -181,9 +181,9 @@ class TestEPoll(unittest.TestCase):
         client.send(b"Hello!")
         server.send(b"world!!!")
 
-        now = time.time()
+        now = time.monotonic()
         events = ep.poll(1, 4)
-        then = time.time()
+        then = time.monotonic()
         self.assertFalse(then - now > 0.01)
 
         events.sort()
@@ -195,9 +195,9 @@ class TestEPoll(unittest.TestCase):
 
         ep.unregister(client.fileno())
         ep.modify(server.fileno(), select.EPOLLOUT)
-        now = time.time()
+        now = time.monotonic()
         events = ep.poll(1, 4)
-        then = time.time()
+        then = time.monotonic()
         self.assertFalse(then - now > 0.01)
 
         expected = [(server.fileno(), select.EPOLLOUT)]
@@ -214,9 +214,9 @@ class TestEPoll(unittest.TestCase):
         ep = select.epoll(16)
         ep.register(server)
 
-        now = time.time()
+        now = time.monotonic()
         events = ep.poll(1, 4)
-        then = time.time()
+        then = time.monotonic()
         self.assertFalse(then - now > 0.01)
 
         server.close()