03-17-2016 11:52 PM
I want to run two different timers in the same code
1. to track the amount of time elapsed since the software was run
2. to track the duration of sub-sequences running for specified durations
I tried calling Timer() in two different threads; but they take the same value.
I want the Timer in thread2 to start from zero while the timer in thread two will keep running with some nonzero value.
Does this problem have any other solutoin?
03-18-2016 12:49 AM
When I user TImer() I never expect it to return 0 at any time.
I allways use something like
starttime = Timer();
...
time =Timer() - starttime;
If you are running really parallel threads with the same code , you have to make sure that starttime is not shared between the threads.
03-21-2016 04:01 AM
Taken from the help (e.g. NI LabWindows/CVI 9.0 Help😞
double Timer (void);
Purpose
Returns the number of seconds elapsed since the first call to Timer, Delay, or SyncWait, or the first operation on a timer control.
The value is never reset to zero except when you restart the program.
The resolution is normally 1 microsecond. However, if you set the useDefaultTimer configuration option to True, the resolution is 55 milliseconds.
So you have to save the start time and calculate the duration yourself.
This is also the case if you intend to use some different timing method like GetTickCount, GetCurrentCVIAbsoluteTime, QueryPerformanceCounter...