示例#1
0
 public Duration()
 {
     if (DurationMethods.QueryPerformanceFrequency(out _Freq) == false)
     {
         throw new Win32Exception();
     }
 }
示例#2
0
 /// <summary>
 /// 开始计时器
 /// </summary>
 public bool Start()
 {
     if (this.RunFlag)
     {
         return(false);
     }
     this.RunFlag = true;
     Thread.Sleep(0);
     this.Begin = DateTime.Now;
     DurationMethods.QueryPerformanceCounter(out _StartTime);
     return(true);
 }
示例#3
0
 /// <summary>
 /// 停止计时器
 /// </summary>
 public bool Stop()
 {
     if (!this.RunFlag)
     {
         return(false);
     }
     this.RunFlag = false;
     this.End     = DateTime.Now;
     DurationMethods.QueryPerformanceCounter(out _StopTime);
     this._DurationValue = (double)(_StartTime - _StopTime) / (double)_Freq * 1000;
     return(true);
 }