120 seconds / 60 would be equal to 2 with 0 remainder
or
121 seconds / 60 would be equal to 2.01666667 or 2 and 1 remainder
What that script does is tell you how many seconds you should display on a clock i.e. if the time was 2 seconds you'd display 2 seconds, if the time was 62 seconds you'd display 2 seconds as well.
The minutes part of the script is pretty straight forward, there are 60 seconds in a minute...
EDIT:
Similarly for days and hours, if you know how many seconds there are in an hour (3,600) and how many seconds in a day (86,400) You can calculate those using the same formula.
1/60 is cero (integer division) :P (i meant that the variable would receive a float value). As displayMinutes will surely be used in a format string like {0:00} then it's better it to be an integer for avoiding the cast. Using the float value directly in the format string will round the display value to the nearest integer.
int casting the exponent part of the real number is simply omitted i.e. rounded down which is exactly what you want and either method has no fewer castings if you were using Time.time I guess your method is fine too.
1/60 is still a decimal
– spinaljackyou probably meant you should cast displayMinutes as an int
– spinaljack1/60 is cero (integer division) :P (i meant that the variable would receive a float value). As displayMinutes will surely be used in a format string like {0:00} then it's better it to be an integer for avoiding the cast. Using the float value directly in the format string will round the display value to the nearest integer.
– Edyint casting the exponent part of the real number is simply omitted i.e. rounded down which is exactly what you want and either method has no fewer castings if you were using Time.time I guess your method is fine too.
– spinaljack