here is small function to do it, i hope you know how to use it..
This is code for make human readable time
def get_readable_time(seconds: int) -> str:
count = 0
ping_time = ""
time_list = []
time_suffix_list = ["s", "m", "h", "days"]
while count < 4:
count += 1
if count < 3:
remainder, result = divmod(seconds, 60)
else:
remainder, result = divmod(seconds, 24)
if seconds == 0 and remainder == 0:
break
time_list.append(int(result))
seconds = int(remainder)
for x in range(len(time_list)):
time_list[x] = str(time_list[x]) + time_suffix_list[x]
if len(time_list) == 4:
rohith += time_list.pop() + ", "
time_list.reverse()
rohith += ":".join(time_list)
return rohith
Here is the code for using the upward function...
start = datetime.now()
x = bot.send_message(message.chat.id, "Pong! ")
end = datetime.now()
ms = (end - start).microseconds / 1000
uptime = get_readable_time((time.time() - StartTime))
x.edit_text(f"⪼ **Ping speed** : `{ms}`\n⪼ **Uptime** : `{uptime}`")
I think this should help you, Hope ya would love my answer and i gave you the correct one