summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-01-25 23:59:41 +0100
committerVictor Stinner <victor.stinner@gmail.com>2014-01-25 23:59:41 +0100
commit73422401b9739009debf50fefbcd5ffe8d0a7d94 (patch)
tree5c6db3875cd7e013050fbee224ce5fa774b7b7aa
parentabd2a2f5bff3a64ba32bc5594ba86ed2ddf3b12d (diff)
downloadtrollius-73422401b9739009debf50fefbcd5ffe8d0a7d94.tar.gz
Simplify BaseEventLoop._run_once(): avoid math.ceil(), use simple arithmetic
instead
-rw-r--r--asyncio/base_events.py7
1 files changed, 1 insertions, 6 deletions
diff --git a/asyncio/base_events.py b/asyncio/base_events.py
index d082bcc..6b5116c 100644
--- a/asyncio/base_events.py
+++ b/asyncio/base_events.py
@@ -18,7 +18,6 @@ import collections
import concurrent.futures
import heapq
import logging
-import math
import socket
import subprocess
import time
@@ -605,8 +604,6 @@ class BaseEventLoop(events.AbstractEventLoop):
elif self._scheduled:
# Compute the desired timeout.
when = self._scheduled[0]._when
- # round deadline aways from zero
- when = math.ceil(when / self.granularity) * self.granularity
deadline = max(0, when - self.time())
if timeout is None:
timeout = deadline
@@ -632,9 +629,7 @@ class BaseEventLoop(events.AbstractEventLoop):
self._process_events(event_list)
# Handle 'later' callbacks that are ready.
- now = self.time()
- # round current time aways from zero
- now = math.ceil(now / self.granularity) * self.granularity
+ now = self.time() + self.granularity
while self._scheduled:
handle = self._scheduled[0]
if handle._when > now: