...
using System;
...
public DateTime start;//开始时间
public DateTime end;//结束时间
...
start = DateTime.UtcNow;
...
end = DateTime.UtcNow;
TimeSpan ts = TimeManager.converTime_long((long)Math.Round((float)(end.Ticks - start.Ticks)/10000000f));//1+7个0
...
...
using System;
...
public static TimeSpan converTime_long(long time)
{
TimeSpan b = TimeSpan.FromSeconds(time);
return b;
}
...
如果出现下面这个报错。说明 其中的一个DateTime时间变量为0。
TimeSpan overflowed because the duration is too long