From 8a19816893f4a9742b7c97b8686f1aa85b39b60c Mon Sep 17 00:00:00 2001 From: SirDank <52797753+SirDank@users.noreply.github.com> Date: Sat, 11 Mar 2023 00:05:01 +0530 Subject: [PATCH] 3.1.2 - updated get_duration to support custom time --- dankware/__init__.py | 5 +++-- setup.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dankware/__init__.py b/dankware/__init__.py index 054eaf3..e4bbc3f 100644 --- a/dankware/__init__.py +++ b/dankware/__init__.py @@ -528,14 +528,15 @@ def fade(text: str, colour: str = "purple") -> str: return faded except: sys.exit(clr(err(sys.exc_info()),2)) -def get_duration(then, now = datetime.now(), interval = "default"): +def get_duration(then, now = datetime.now(), interval = "default") -> str: """ Returns a duration as specified by the 'interval' variable """ duration = now - then # For build-in functions - duration_in_s = int(duration.total_seconds()) + try: duration_in_s = int(duration.total_seconds()) + except: duration_in_s = int(duration) def time_units(duration_in_s): years, rem = divmod(duration_in_s, 31536000) diff --git a/setup.py b/setup.py index 14a8c17..b353846 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="dankware", - version="3.1.1", + version="3.1.2", author="SirDank", author_email="SirDankenstein@protonmail.com", description="Python module with various features.",