From 83496c5df852fb3e8bdfe10f382c207a238b1a81 Mon Sep 17 00:00:00 2001 From: "R. M" <50295204+glomatico@users.noreply.github.com> Date: Tue, 29 Nov 2022 18:43:28 -0300 Subject: [PATCH] round lrc time --- gamdl.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gamdl.py b/gamdl.py index 941a372..e2f5b02 100644 --- a/gamdl.py +++ b/gamdl.py @@ -202,9 +202,12 @@ class Gamdl: m = int(unformatted_time.split('.')[-2].split(':')[-2]) * 60000 except: m = 0 - ms = int(f'{unformatted_time.split(".")[-1]}') - ms = int((round(float(f'1.{ms:03d}'), 2) - 1) * 1000) - formated_time = datetime.datetime.fromtimestamp((s + m + ms) / 1000.0) + ms = f'{int(unformatted_time.split(".")[-1]):03d}' + if int(ms[2]) >= 5: + ms = int(f'{int(ms[:2]) + 1}') * 10 + else: + ms = int(ms) + formated_time = datetime.datetime.fromtimestamp((s + m + ms)/1000.0) return formated_time.strftime('%M:%S.%f')[:-4]