DateTime _updateIoTime = DateTime.Now;//获取当前时间
Task task = Task.Run(() =>
{
while (true)
{
DateTime nowTime = DateTime.Now;//获取当前时间
TimeSpan timeSpan = nowTime - _updateIoTime;
double dSpan = timeSpan.TotalSeconds;
if (dSpan > 5)
{
}
}
});