Skip to content

Commit

Permalink
3.1.2
Browse files Browse the repository at this point in the history
- updated get_duration to support custom time
  • Loading branch information
SirDank committed Mar 10, 2023
1 parent effa27d commit 8a19816
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions dankware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="dankware",
version="3.1.1",
version="3.1.2",
author="SirDank",
author_email="[email protected]",
description="Python module with various features.",
Expand Down

0 comments on commit 8a19816

Please sign in to comment.