Fix uptime negative time error by saving it as UTC from the start.

This commit is contained in:
luukas
2021-04-18 00:20:23 +03:00
parent 9049e44803
commit 736924c839
4 changed files with 15 additions and 25 deletions

View File

@ -130,8 +130,8 @@ class Server:
self.process = pexpect.spawn(self.server_command, cwd=self.server_path, timeout=None, encoding=None)
self.is_crashed = False
ts = time.time()
self.start_time = str(datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S'))
# see https://docs.python.org/3/library/datetime.html#datetime.datetime.now
self.start_time = str(datetime.datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S'))
if psutil.pid_exists(self.process.pid):
self.PID = self.process.pid