Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Windriver Timing the fast loops, Timer.h? (http://www.chiefdelphi.com/forums/showthread.php?t=71653)

wt200999 08-01-2009 23:59

Windriver Timing the fast loops, Timer.h?
 
Is it okay to use the timer class in windriver for quick times. I am trying to get the time between the fast loops, but I am not sure how to achieve this. I see in the IterativeRobot.cpp that they implement a timer, maybe instead of creating my own I can get something from that one. This is how I had first though of using it with its own timer (it would start in the constructor):

Code:

void Robot::AutonomousContinuous()
{
        Timer->Stop();
        m_class.Process(Timer->Get());
        Timer->Reset();
        Timer->Start();
}

Or maybe there is a better way of doing this? I want to make sure that I am getting an accurate time if that's possible.

Jlulian 09-01-2009 00:19

Re: Windriver Timing the fast loops, Timer.h?
 
You could use the timer class, but in the same header as that is defined is the "GetTime()" function, which is used internally in the class, and is simpler to work with.

Using it would look something like this:
Code:

void Robot::AutonomousContinuous()
{
        double timeChange = GetTime() - lastTime
        //Time dependent Code..
        lastTime = GetTime();
}

(this code snippet assumes you've got a lastTime variable in your class)


All times are GMT -5. The time now is 00:04.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi