Advertisement
LucasSousa

Time_Formater (test)

Dec 30th, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. class TF:
  2.  
  3.     def formatar(self, tempo):
  4.         self.tempo = tempo
  5.         return self.get_minutes() + ":" + self.get_seconds() + "." + self.get_milliseconds()
  6.  
  7.     def get_seconds(self):
  8.         segundos = (int(round((self.tempo / 1000) % 60)))
  9.         if segundos < 10:
  10.             return "0" + str(segundos)
  11.         else:
  12.             return str(segundos)
  13.  
  14.     def get_minutes(self):
  15.         minuto = (int(round((self.tempo / 60000) % 60)))
  16.         if minuto < 10:
  17.             return "0" + str(minuto)
  18.         else:
  19.             return str(minuto)
  20.  
  21.     def get_milliseconds(self):
  22.         milis = (int(round((self.tempo % 1000))))
  23.         if milis < 10:
  24.             return "00" + str(milis)
  25.         elif 100 > milis > 10:
  26.             return "0" + str(milis)
  27.         else:
  28.             return str(milis)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement