Page 1 of 1

Problem on Beginner-Tutorial17 (Chrono)

Posted: January 14th, 2019, 7:30 pm
by tarunchand28021998
Could somebody please help me with a problem regarding tutorial 17 in beginner c++ series.
I attempted to make a Time struct and made a float variable to store the deltaTime. I also made a function to update the deltaTime which runs inside the UpdateModel in Game.cpp . However, the deltaTime seems to give very high values. Could somebody please take a look and give a hint of what I could be doing wrong.

I have uploaded the header file in this link:
https://github.com/tarunChand28298/QuestionOnChrono.git

Re: Problem on Beginner-Tutorial17 (Chrono)

Posted: January 15th, 2019, 12:27 am
by Pindrought
You are not assigning present time before doing the calculation.

Line 16 should be the first line of CalculateDeltaTime()

Re: Problem on Beginner-Tutorial17 (Chrono)

Posted: January 15th, 2019, 5:42 am
by tarunchand28021998
Thanks man! That seems to work.

And, by the way, there was one other thing int the code which was causing the problem.
I was supposed to use std::chrono::duration<float> but I was using std::chrono::steady_clock::duration.

I did not expect somebody to help this fast. Thanks again man!

Re: Problem on Beginner-Tutorial17 (Chrono)

Posted: January 15th, 2019, 6:54 am
by albinopapa
There may not be a lot of chatter in the forum, but there are usually people prowling around. Most are probably on/in the discord.

Re: Problem on Beginner-Tutorial17 (Chrono)

Posted: January 16th, 2019, 1:48 pm
by chili
*prowls*