Quote:
Originally Posted by SuperViper
pawn Код:
timeFromSeconds(seconds, &returnedMinutes, &returnedSeconds) { returnedMinutes = floatround(seconds / 60, floatround_floor); returnedSeconds = seconds - (returnedMinutes * 60); }
Usage:
pawn Код:
new minutes, seconds; timeFromSeconds(342, minutes, seconds);
Minutes will be 5 and seconds will be 42.
|
This:
pawn Код:
returnedMinutes = floatround(seconds / 60, floatround_floor);
is the same as:
First dividing the numbers normally as integers, then converting the result to a float!
pawn Код:
returnedMinutes = floatround(float(seconds / 60), floatround_floor);
which is the same as:
pawn Код:
returnedMinutes = seconds / 60;
Integer divisions always truncate the decimals (basically just removes them, which is what floatround_floor does to numbers > 0).