?
Solved

About timer in MFC

Posted on 2000-03-02
5
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 15 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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