real time clock in VC++
Posted on 1997-06-11
I want to write a program in Visual C++ 5.0 using MFC, which uses some kind of "real time clock".
Ok, when the program starts, the clock should start with time unit 0. Then it should count the time units in 1/10 of a second.
From my experiences with Java, I thought about using a thread, in which the clock will run. It should only count the time units and return the current, when asked for.
The main thread would then do the main work and whenever something new must be done, it should call the clock to ask for the "time". If the time is right, the next thing can be done.
Another idea is to use the function "_ftime" which returns the current time, I guess. The problem then can be the necessary calculation to do to translate the time struct to the appropriate time units. I think, this needs too much time.
It would be nice, if you could tell me which way would be the easiest(using threads, _ftime or another). It would be fine too, if you could give an example by including some example source code.
Thanks in advance, re.