Model/StopWatchTimer.cs
(开头部分) 2KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace CustomTimers
{
class StopWatchTimer : CustomTimer
{
//-----------------------------------------------
// Private member functions
//-----------------------------------------------
private int UpdateInternalTimeRunning = 0;
private void UpdateInternalTime ()
{
// Prevent Reentry
if (Interlocked.Exchange (ref UpdateInternalTimeRunning, 1) == 0)
{
//DateTime currentTime = DateTime.Now;
//_Millisecond += (currentTime.Millisecond - _SystemTimeLatched.Millisecond);
//_Second += (currentTime.Second - _SystemTimeLatched.Second);
//_Minute += (currentTime.Minute - _SystemTimeLatched.Minute);
//_Hour += (currentTime.Hour - _SystemTimeLatched.Hour);
//_SystemTimeLatched = DateTime.Now;
_DiagnosticsStopWatch.Stop ();
TimeSpan timeElapsed = _DiagnosticsStopWatch.Elapsed;
long totalMilliseconds = Convert.ToInt64 (timeElapsed.TotalMilliseconds);
long intervalInMs = GetIntervalInMilliseconds ();
long totalTime = Convert.ToInt64 (
(double) totalMilliseconds / (double) intervalInMs)
* intervalInMs;
_Millisecond = (int) (totalTime % 1000);
totalTime = totalTime / 1000;
_Second = (int) (totalTime % 60);
totalTime = totalTime / 60;
_Minute = (int) (totalTime % 60);
totalTime = totalTime / 60;
_Hour = (int) (totalTime % 60);
//FindEffectivTime ();
_DiagnosticsStopWatch.Start ();
Interlocked.Exchange (ref UpdateInternalTimeRunning, 0);
}
}
//-----------------------------------------------
// Public member function
//-----------------------------------------------
public StopWatchTimer ()
后面还有 15 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
