Click to See Complete Forum and Search --> : Need to keep track of milliseconds


Randy C
April 15th, 1999, 10:16 AM
I have a time consuming process controlled by a Modal Dialog box, and I don't want to start a second thread. So I just started a timer going at 100mS intervals, and have a state machine running in my OnTimer handler. This way I still get to service an abort button, and post progress messages in various edit boxes. I was hoping that within my process state machine, I could watch the elapsed time and return anytime approximatly 800 milliseconds passed. I say approximate because it really wouldn't matter that much how many WM_TIMER messages I missed, since my worst case wasted time would be 100mS, or 1/8 of my kludged "time slice". Problem is that much to my surprise, I cant find a simple system level timer I can read to see when 800 mS has passed. I could use CElapsedTime to calculate the difference between two Ctime objects, but that only resolves to the second. I did notice there is a thing called a CRefTime class that resolves to 100 nanoSeconds, but it seems like a static reference rather then a running timer. Am I missing something obvious? If there is a class to hold a time resolving to 100 nS, there ought to be some way to access current time that way. Heck, Even the old DOS bios "Tick" timer would be close enough for what I want to do. Any thoughts.

--Randy C
* * * Second star to the Right!

Harvey Hawes
April 15th, 1999, 11:20 AM
Hi,

There are articles on this site for that (see the Misc. Section).

Also see the docs on GetTickCount()...


HTH,


Harvey Hawes

Software Engineer
BioScience Analysis Software Ltd.

Masters Candidate
Cardiovascular/Respiratory Sciences
Faculty of Medicine
University of Calgary
Calgary, Alberta, Canada

Randy C
April 15th, 1999, 03:26 PM
Thanks! Just what the doctor ordered!

--Randy C
* * * Second star to the Right!