Problem on Beginner-Tutorial17 (Chrono)

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
tarunchand28021998
Posts: 2
Joined: January 14th, 2019, 7:10 pm

Problem on Beginner-Tutorial17 (Chrono)

Post by tarunchand28021998 » January 14th, 2019, 7:30 pm

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

Pindrought
Posts: 432
Joined: September 26th, 2013, 4:57 pm
Location: Kentucky
Contact:

Re: Problem on Beginner-Tutorial17 (Chrono)

Post by Pindrought » January 15th, 2019, 12:27 am

You are not assigning present time before doing the calculation.

Line 16 should be the first line of CalculateDeltaTime()
PM me if you need to contact me. Thanks to all the helpful people on this forum especially to Chili.

tarunchand28021998
Posts: 2
Joined: January 14th, 2019, 7:10 pm

Re: Problem on Beginner-Tutorial17 (Chrono)

Post by tarunchand28021998 » January 15th, 2019, 5:42 am

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!

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Problem on Beginner-Tutorial17 (Chrono)

Post by albinopapa » January 15th, 2019, 6:54 am

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.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Problem on Beginner-Tutorial17 (Chrono)

Post by chili » January 16th, 2019, 1:48 pm

*prowls*
Chili

Post Reply