09.09.2011, 16:35
Here's a function I wrote a while back that you may find useful:
Usage example:
You should be able to edit that to your needs!
pawn Код:
/*Usage: The seconds parameter should be the amount of seconds you want to convert and
the rest of the parameters should be variables to store the integer value for each of the
time values*/
stock formatSeconds(seconds, &hours_left, &minutes_left, &seconds_left)
{
hours_left = seconds/60/60;
minutes_left = (seconds - hours_left*60*60)/60;
seconds_left = (seconds - hours_left*60*60 - minutes_left*60);
return 1;
}
pawn Код:
new
hours,
minutes,
seconds;
formatSeconds(5000, hours, minutes, seconds);
printf("Hours: %d, Minutes: %d, Seconds: %d in 5000 seconds", hours, minutes, seconds);