Thread: MAKI Cheats
View Single Post
Old 9th November 2002, 02:31   #124
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
Join Date: Oct 2001
Posts: 2,032
Parse MS to Real Time mm:ss

code:
Function string parseMST(int MS);

parseMST(int MS)
{

if (getStatus() != 0)
{

int secs, mins, subsecs;
string Ssubsecs;
secs = MS/1000;

if (secs > 59)
{
mins = secs/60;
subsecs = secs - (mins*60);
Ssubsecs = integerToString(subsecs);

}
else
{
mins = 0;
subsecs = MS/1000;
Ssubsecs = integerToString(subsecs);
}

if (strlen(Ssubsecs) < 2)
{
string temp2;
temp2 = Ssubsecs;
Ssubsecs = "0" + temp2;
}

string returnS;
returnS = integerToString(mins) + ":" + Ssubsecs;

return returnS;
}
else
{
return "0:00";
}

}

this returns milli seconds in real time format. ie. mm:ss

all you need to do is somthing like
code:
currentlen = parseMST(getPosition());
totallen = parseMST(getPlayItemLength());

ad it will return the current elapsed time in mm:ss and the total track time in mm:ss...
dunno how usefull this will be, but, its here anyway...

[edit]
new version returns 0:00 if stoped
[/edit]
[edit2]
doesnt do any parsing if stoped now
saving cpu
[/edit2]

Bizzy D
Bizzeh is offline   Reply With Quote