コード例 #1
0
    def start(self):
        """Reset the reactor completely

        You don't need to use this if you use ReactorTestCase, which wraps your
        tests in fresh restarts.
        """
        if self.waker is not None:
            # make sure that subsequent shutdowns won't disconnect an
            # active waker, due to wakers assuming they're singletons  :(
            self.removeReader(self.waker)
        self.__dict__.clear()
        self.__init__()
        self._simulated_time = realtime()
        self._use_realtime = None
コード例 #2
0
 def getTime(self):
     """Get the current simulated (or real) time"""
     if self._use_realtime:
         return realtime()
     self._use_realtime = False  # once we've read it, disallow changing it
     return self._simulated_time