Advertisement
Guest User

Godot timestap code

a guest
Aug 19th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. func getTimeStamp(millisec):
  2.     var seconds = (millisec / 1000)
  3.     var minutes = floor(seconds / 60)
  4.     var hours = 0
  5.     if minutes > 59:
  6.         hours = floor(minutes / 60)
  7.         minutes = minutes - (hours * 60)
  8.        
  9.     seconds = floor(seconds % 60)
  10.     var str_hours = str(hours) if (hours >= 10) else "0" + str(hours)
  11.     var str_mins = str(minutes) if (minutes >= 10) else "0" + str(minutes)
  12.     var str_secs = str(seconds) if (seconds >= 10) else "0" + str(seconds)
  13.     if hours != 0:
  14.         return str_hours + ":" + str_mins + ":" + str_secs
  15.     return str_mins + ":" + str_secs
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement