Solved

About timer in MFC

Posted on 2000-03-02
5
174 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Perl Awk Need Help 3 94
Generic progress indicator 6 109
Replacement selected text 2 47
method notes when mouse over in eclipse 5 68
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now