CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Location
    Tampa, FL
    Posts
    114

    Need to keep track of milliseconds

    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!

  2. #2
    Join Date
    May 1999
    Posts
    36

    Re: Need to keep track of milliseconds

    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

  3. #3
    Join Date
    Apr 1999
    Location
    Tampa, FL
    Posts
    114

    Re: Need to keep track of milliseconds

    Thanks! Just what the doctor ordered!

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured