From adb79dd6543d5cbd7d6b00de374e262cc8fe9af5 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Tue, 8 Jun 2021 02:14:44 +0200 Subject: [PATCH] using right tz for the 5th times >:( --- src/utils/time.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/utils/time.py b/src/utils/time.py index 4e75dda..2f68c5c 100644 --- a/src/utils/time.py +++ b/src/utils/time.py @@ -72,17 +72,15 @@ def timedeltaToString(time): return ''.join(age) def getAge(date): - """Recupère un âge précisément à la seconde près""" - now = intToDatetime(nowUTC()) - heureAjouter = int(str(UTCDatetimeToCustomDatetime(now)).split('+')[1].split(':')[0]) - joursRestants = now - date + """Décompose la différence entre une date et maintenant avec les bons timezone""" + joursRestants = UTCDatetimeToCustomDatetime(intToDatetime(nowUTC())) - UTCDatetimeToCustomDatetime(date) years = joursRestants.total_seconds() / (365.242 * 24 * 60 * 60) months = (years - int(years)) * 12 days = (months - int(months)) * (365.242 / 12) hours = (days - int(days)) * 24 minutes = (hours - int(hours)) * 60 seconds = (minutes - int(minutes)) * 60 - return (int(years), int(months), int(days), int(hours) + heureAjouter, int(minutes), int(seconds)) + return (int(years), int(months), int(days), int(hours), int(minutes), int(seconds)) def ageLayout(tuple): """Avec la méthode `getAge`, permet de mettre en forme un âge⁢⁢⁢⁢⁢⁢⁢⁢⁢⁢"""