Exemplo n.º 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()
Exemplo n.º 2
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()
Exemplo n.º 3
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
Exemplo n.º 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
Exemplo n.º 5
0
 def __call__(self):
     remaining = self._succeed_time - monotonic()
     if remaining > 0:
         raise SucceedLaterException(
             'time until success: {} seconds'.format(remaining))
     return 'success'
Exemplo n.º 6
0
 def __init__(self, duration):
     self._succeed_time = monotonic() + duration
Exemplo n.º 7
0
	def __init__(self, duration):
		self._succeed_time = monotonic() + duration
Exemplo n.º 8
0
	def __call__(self):
		remaining = self._succeed_time - monotonic()
		if remaining > 0:
			raise SucceedLaterException('time until success: {} seconds'.format(remaining))
		return 'success'