Exemple #1
0
        public double GetElapsedTimeSeconds( )
        {
            if (true == this.mStarted)
            {
                long currentCount = 0;
                STPrecisionTimer.Kernel32_QueryPerformanceCounter(out currentCount);

                if (this.mCountsPerSecond > 0)
                {
                    return((double)(currentCount - this.mStartCount) / ((double)this.mCountsPerSecond));
                }
                else
                {
                    return(0.0);
                }
            }

            return(0.0);
        }
Exemple #2
0
        public void SetReferenceTimeToNow( )
        {
            if (false == this.mStarted)
            {
                if (false == STPrecisionTimer.Kernel32_QueryPerformanceFrequency(out this.mCountsPerSecond))
                {
                    // Failed
                }
                else
                {
                    this.mStarted = true;
                }
            }

            if (true == mStarted)
            {
                STPrecisionTimer.Kernel32_QueryPerformanceCounter(out this.mStartCount);
            }
        }