Spaces:
Running
Running
def Time_ISTKolNow(): | |
from datetime import datetime | |
import pytz | |
IST = datetime.now(pytz.timezone("Asia/Kolkata")).strftime("%c") | |
return IST | |
def mime_identifier(filename): | |
import mimetypes | |
mime_type, encoding = mimetypes.guess_type(filename) | |
return mime_type | |
def TimeFormatter(milliseconds: int) -> str: | |
seconds, milliseconds = divmod(int(milliseconds), 1000) | |
minutes, seconds = divmod(seconds, 60) | |
hours, minutes = divmod(minutes, 60) | |
days, hours = divmod(hours, 24) | |
tmp = ((str(days) + "d, ") if days else "") + \ | |
((str(hours) + "h, ") if hours else "") + \ | |
((str(minutes) + "m, ") if minutes else "") + \ | |
((str(seconds) + "s, ") if seconds else "") + \ | |
((str(milliseconds) + "ms, ") if milliseconds else "") | |
return tmp[:-2] |