Skip to content

Commit

Permalink
Fix date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jshcodes committed Dec 21, 2023
1 parent ba7e354 commit 71e7d37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion samples/rtr/get_host_uptime.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def find_nth(haystack: str, needle: str, nth: int):
def convert_windows_time(incoming: str):
"""Convert Windows time stamps to human readable format."""
cur_time = datetime.now()
incoming = datetime.strptime(incoming[:incoming.find("+")], "%Y%m%d%H%M%S.%f")
incoming = datetime.strptime(incoming[:incoming.find("+")][:incoming.find(".")], "%Y%m%d%H%M%S")
delta: timedelta = cur_time - incoming
hour_min = ':'.join(str(timedelta(seconds=delta.seconds)).split(':')[0:2])
return f"up {delta.days} days, {hour_min}"
Expand Down

0 comments on commit 71e7d37

Please sign in to comment.