Okay, sorry about that then!
How about this then?
If you start the server at 19:00, and it runs till 20:55, it would be something like this
20 - 19 = 1 hour
55 - 00 = 55 minutes
So it's basically 20:55 - 19:00, but both hours and minutes divided into 2.
pawn Код:
stock CalculateUpTime()
{
new TimeString[2][6], ResultString[2], ResultString2[2], FinalResult[6];
/* Load the string, say the server started at 16:43 and ran until 19:48 */
split(TimeString[1], ResultString, ':'); // 16:43
split(TimeString[2], ResultString2, ':');
Hours = ResultString2[1] - ResultString[1];
Minutes = ResultString2[2] - ResultString[2];
format(FinalResult, sizeof(FinalResult), "%d:%d", Hours, Minutes);
return FinalResult;
}
or you could pass the time on from another function
pawn Код:
stock CalculateUpTime(TimeString[], TimeString2[])
{
new ResultString[2], ResultString2[2], FinalResult[6];
/* Load the string, say the server started at 16:43 and ran until 19:48 */
split(TimeString, ResultString, ':'); // 16:43
split(TimeString2, ResultString2, ':');
Hours = ResultString2[1] - ResultString[1];
Minutes = ResultString2[2] - ResultString[2];
format(FinalResult, sizeof(FinalResult), "%d:%d", Hours, Minutes);
return FinalResult;
}
How about this? Not tested, but you get the basic idea, right?
EDIT: Remade them to stocks, only stocks can return strings. Sorry about that.
Also, if you want it in mintues only, you could just finish like this
pawn Код:
Minutes += Hours * 60;
return Minutes;
Hope this helps