Solved

About timer in MFC

Posted on 2000-03-02
5
179 Views
Last Modified: 2013-11-20
Hello,

I am developing an application in VC++ 5.0/MFC. This application is to be run for 2000 hrs. continuously. I have to take readings periodically using this application. For that i am using StartTimer() and KillTimer(). I want to ask whether they work perfectly for this much long time and also if windows OS is run for 2000 hrs is it ok? Will it cause time lag after some time or not ? Thanks.
0
Comment
Question by:namrata
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:poohbear_68
ID: 2578662
Timer handlers are not guaranteed to be called.  Depending on the circumstance (e.g. Windows is busy doing something else), they may not be called.  You will want to have the intervals fairly frequent because of this.

I haven't really researched it, but (other than first paragraph) I would think that it should be fairly reliable.

Timers are not precise, so you may wish to check out another method.
0
 

Author Comment

by:namrata
ID: 2578684
Can u suggest any other method?
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 5 total points
ID: 2578922
run the timer function very often and check the actual time.  If the current time is >= the time for the next reading, then take it.

The accuracy will then depend on how often the timer fires.  eg if readings are to betaken every minute, and the timer fires every second, then the readings should be accuractly to the nearest second (approx).

If you want it more exact, wait until you are within a certain (small) time before the even you want and then just go into a while loop checking for the time. (eg. if you are within 1 second before the nextreading, do a loop checking the time until the time is >= what you need).

how to do it really depends on how accurately and frequently the readings are to be taken.

0
 

Author Comment

by:namrata
ID: 2582986
ok. i have to take readings minimum at 1 minute. so accuracy should not be much problem.  What about windows OS? Any problem if it is run for a long time?
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2585958
You're leaving yourself open for a lot of anti-MS comments here :-)

Windows OS should be fine for long periods.  Win2000 especially as it has been written for use in servers (which are supposed to have very high availability).  I don't thinkg you'll find the OS itself is really a problem.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 169
Excel Use VBA to get user's Mac Address for their computer 5 242
how to monitor remote shell execution on linux 9 104
MaxSpan challenge 9 105
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question