コード例 #1
0
    def time(self):
        """Return the time according to the event loop's clock.

		This is a float expressed in seconds since an epoch, but the
		epoch, precision, accuracy and drift are unspecified and may
		differ per event loop.
		"""
        return monotonic()
コード例 #2
0
ファイル: EventLoop.py プロジェクト: palmer-dabbelt/portage
	def time(self):
		"""Return the time according to the event loop's clock.

		This is a float expressed in seconds since an epoch, but the
		epoch, precision, accuracy and drift are unspecified and may
		differ per event loop.
		"""
		return monotonic()
コード例 #3
0
ファイル: test_retry.py プロジェクト: gentoo/portage
	def __call__(self):
		loop = global_event_loop()
		result = loop.create_future()
		remaining = self._succeed_time - monotonic()
		if remaining > 0:
			loop.call_soon_threadsafe(lambda: None if result.done() else
				result.set_exception(SucceedLaterException(
				'time until success: {} seconds'.format(remaining))))
		else:
			loop.call_soon_threadsafe(lambda: None if result.done() else
				result.set_result('success'))
		return result
コード例 #4
0
 def __call__(self):
     loop = global_event_loop()
     result = loop.create_future()
     remaining = self._succeed_time - monotonic()
     if remaining > 0:
         loop.call_soon_threadsafe(
             lambda: None if result.done() else result.set_exception(
                 SucceedLaterException('time until success: {} seconds'.
                                       format(remaining))))
     else:
         loop.call_soon_threadsafe(lambda: None if result.done() else result
                                   .set_result('success'))
     return result
コード例 #5
0
 def __call__(self):
     remaining = self._succeed_time - monotonic()
     if remaining > 0:
         raise SucceedLaterException(
             'time until success: {} seconds'.format(remaining))
     return 'success'
コード例 #6
0
 def __init__(self, duration):
     self._succeed_time = monotonic() + duration
コード例 #7
0
ファイル: test_retry.py プロジェクト: gentoo/portage
	def __init__(self, duration):
		self._succeed_time = monotonic() + duration
コード例 #8
0
ファイル: test_retry.py プロジェクト: palmer-dabbelt/portage
	def __call__(self):
		remaining = self._succeed_time - monotonic()
		if remaining > 0:
			raise SucceedLaterException('time until success: {} seconds'.format(remaining))
		return 'success'