C++/timer

Advertisement


Question
how do i put a timer in a progrom like for computing for its efficienct im using microsoft visual c++ tnx ps the time shud b in nanosec. or millisec.

Answer
Hello Nicolo, thank you for the question.

Use the function GetTickCount() which can be found in Windows.h. It returns a DWORD that is the elapsed seconds, and if used correctly, can give you the nanoseconds simply by dividing until you get the number you want, as it returns milliseconds naturally.

I hope this information was useful.

- Eddie

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Eddie

Expertise

I can answer questions about the C++ language, object oriented design and architecture. I am knowledgable in a lot of the math that goes into programming, and am certified by ExpertRating.com. I also know a good deal about graphics via OpenGL, and GUIs.

Experience

I have completed numerous games and demos created with the C++ programming language. Currently employed as a software engineer in the modeling and simulation field. I have about 7 years experience.

©2016 About.com. All rights reserved.