File size: 780 Bytes
e566133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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]