I'm alittle lazy and not too good with things like this. But I need to use the ITimer to find the minutes and seconds thats passed since I last reset it. But, I get these outrages differences when I change on digit . Like
if(Time >= 3000) //Millisecs
{
. . . .
}
If I change that to 4000 the time doesnt' change at all. . . . Could someone paste some code for a timer?
Using the ITimer for Minutes/Seconds
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact:
Code: Select all
//1000ms = 1 second
//60sec = 1 minute
//60000ms = 1 minute
void getTimeSince(u32 time, u32 & minutes, u32 & seconds) {
u32 currTime = ITimer->getTime()
u32 delta = currTime - time;
// delta = minutes * 60000 + seconds * 1000 + ms
//get num ms left that dont make up a minute ( afterMinutes = seconds * 1000 + ms )
u32 afterMinutes = delta % 60000;
minutes = (delta-afterMinutes)/60000;
//get num ms left that dont make up a second ( afterseconds = ms )
u32 afterSeconds = afterMinutes % 1000;
seconds = (delta - minutes*60000 - afterSeconds) / 1000;
}
a screen cap is worth 0x100000 DWORDS
i wrote a timer class to handle this for Fmorg...
here is a link to it:
http://buhatkj.dyndns.org:4242/tempfiles/fmorgTimer.h
i sent it in to niko, as a proposed addition to 0.05, but it is of course up to him if he decides to adapt it for that purpose.
oh, and it still uses ms, so i just multiply the seconds by 1000 when i pass it the time to set for. it wouldnt be too hard to just add another version of the set func that does that part for ya tho.
-Ted
http://buhatkj.dyndns.org:4242/tempfiles/fmorgTimer.h
i sent it in to niko, as a proposed addition to 0.05, but it is of course up to him if he decides to adapt it for that purpose.
oh, and it still uses ms, so i just multiply the seconds by 1000 when i pass it the time to set for. it wouldnt be too hard to just add another version of the set func that does that part for ya tho.
-Ted
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
-
- Posts: 386
- Joined: Thu Sep 25, 2003 12:43 pm
- Contact: