/// <summary> /// 刷新时间 /// </summary> /// <param name="state"></param> private static void refreshTime(object state) { DateTime now = DateTime.Now; Now = now; UtcNow = now.localToUniversalTime(); timer.Change(TimerInterval = 1000L - now.Millisecond, -1); #if !Serialize CHECK: long nextSecondTicks = NextSecondTicks; if (nextSecondTicks <= Now.Ticks) { if (Interlocked.CompareExchange(ref NextSecondTicks, nextSecondTicks + TimeSpan.TicksPerSecond, nextSecondTicks) == nextSecondTicks) { Interlocked.Increment(ref CurrentSeconds); try { AutoCSer.Threading.ThreadPool.CheckExit(); for (AutoCSer.Log.File fileLog = AutoCSer.Log.File.Files.End; fileLog != null; fileLog = fileLog.DoubleLinkPrevious) { fileLog.OnTimer(); } for (AutoCSer.Net.SocketTimeoutLink.TimerLink timeout = AutoCSer.Net.SocketTimeoutLink.TimerLink.TimeoutEnd; timeout != null; timeout = timeout.DoubleLinkPrevious) { timeout.OnTimer(); } for (AutoCSer.Net.TcpServer.ClientCheckTimer timeout = AutoCSer.Net.TcpServer.ClientCheckTimer.TimeoutEnd; timeout != null; timeout = timeout.DoubleLinkPrevious) { timeout.OnTimer(); } for (AutoCSer.TimeoutCount timeout = AutoCSer.TimeoutCount.OnTimerLink.End; timeout != null; timeout = timeout.DoubleLinkPrevious) { timeout.OnTimer(); } if (IsOnTime) { if (SqlOnTime != null) { SqlOnTime.OnTimer(); } if (WebViewOnTime != null) { WebViewOnTime.OnTimer(); } if (CacheServerOnTime != null) { CacheServerOnTime.OnTimer(); } if (TcpSimpleServerOnTime != null) { TcpSimpleServerOnTime.OnTimer(); } } AutoCSer.Threading.TimerTask.Default.OnTimer(Now); if (Date.OnTime != null) { Date.OnTime(); } } catch (Exception error) { AutoCSer.Log.Pub.Log.Add(AutoCSer.Log.LogType.Error, error); } } goto CHECK; } #endif }