def time(): if current_coordinates is None: return _time_machine.original_time() else: return current_coordinates.destination_timestamp + ( _time_machine.original_time() - current_coordinates.real_start_timestamp)
def time(self): if not self._tick: return self.destination_timestamp if not self.requested: self.requested = True self.real_start_timestamp = _time_machine.original_time() return self.destination_timestamp return self.destination_timestamp + (_time_machine.original_time() - self.real_start_timestamp)
def gmtime(secs=None): if current_coordinates is None or secs is not None: return _time_machine.original_gmtime(secs) else: return _time_machine.original_gmtime( current_coordinates.destination_timestamp + (_time_machine.original_time() - current_coordinates.real_start_timestamp))
def start(self): global current_coordinates if current_coordinates is not None: raise RuntimeError("Cannot time travel whilst already travelling.") _time_machine.patch() current_coordinates = Coordinates( destination_timestamp=self.destination_timestamp, real_start_timestamp=_time_machine.original_time(), )
def time(): if not coordinates_stack: return _time_machine.original_time() return coordinates_stack[-1].time()
def _time_ns(self): return _time_machine.original_time() * NANOSECONDS_PER_SECOND