Commit 821abfc7 authored by fmg005's avatar fmg005

Refactored method

parent 91463522
......@@ -17,13 +17,14 @@ void Realtime::AdvanceModelTime(double time) {
m_end = clock();
/* start time for the next execution */
m_real_time = m_start + (m_next_start * time);
m_next_start = CLOCKS_PER_SEC * time;
m_real_time = m_start + m_next_start;
/* check if simuation takes longer than expected
i.e., time = 1.0s
clocks (1s real-time equivalent) = CLOCKS_PER_SEC * time
*/
if ((m_end - m_start) > (CLOCKS_PER_SEC * time))
if ((m_end - m_start) > m_next_start)
m_logger->error("Simulation too slow");
/* wait until start time of next execution is reached i.e., 1s of real-time */
......
......@@ -22,7 +22,7 @@ namespace CLA {
CLA::LOGGER* m_logger;
Config m_cfg;
clock_t m_real_time, real_start, m_delta, m_start, m_end;
clock_t m_next_start = CLOCKS_PER_SEC;
clock_t m_next_start;
long m_delta_secs;
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment