From 38fadf09d04df6bd7bf2aebd2831bb13c13abdcd Mon Sep 17 00:00:00 2001 From: Jxck-S Date: Sun, 4 Oct 2020 19:37:25 -0400 Subject: [PATCH] Remove leading zeros on flight time --- planeClass.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/planeClass.py b/planeClass.py index cc72fe5..fd4affc 100644 --- a/planeClass.py +++ b/planeClass.py @@ -40,6 +40,9 @@ class Plane: main_config = configparser.ConfigParser() main_config.read('mainconf.ini') + #Platform for determining OS for strftime + import platform + if self.config.getboolean('GOOGLE', 'STATICMAP_ENABLE'): from defMap import getMap else: @@ -237,7 +240,10 @@ class Plane: self.landed_time_msg = "" if self.takeoff_time != None: self.landed_time = time.time() - self.takeoff_time - self.landed_time_msg = time.strftime("Apx. flt. time %H Hours : %M Mins ", time.gmtime(self.landed_time)) + if platform.system() == "Linux": + self.landed_time_msg = time.strftime("Apx. flt. time %-H Hours : %-M Mins ", time.gmtime(self.landed_time)) + elif platform.system() == "Windows": + self.landed_time_msg = time.strftime("Apx. flt. time %#H Hours : %#M Mins ", time.gmtime(self.landed_time)) if self.invalid_Location is False: self.landed_message = ("Landed just now in" + " " + self.aera_hierarchy + ", " + self.state + ", " + self.country_code + ". " + self.landed_time_msg) else: