123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace TUCamera
- {
- public class DateTimeTools
- {
- private TimeSpan m_startTime;
- private UInt64 m_duration = 0;
- public DateTimeTools(UInt64 durationMs)
- {
- m_startTime = new TimeSpan(DateTime.Now.Ticks);
- m_duration = durationMs;
- }
- public TimeSpan StartTime
- {
- set
- {
- m_startTime = value;
- }
- }
- public void Restart()
- {
- m_startTime = new TimeSpan(DateTime.Now.Ticks);
- }
- public bool Timeout()
- {
- bool result = false;
- UInt64 intervalTime = 0;
- TimeSpan stopTime = new TimeSpan(DateTime.Now.Ticks);
- intervalTime = (UInt64)m_startTime.Subtract(stopTime).Duration().TotalMilliseconds;
- if (intervalTime > m_duration)
- {
- result = true;
- }
- return result;
- }
- }
- }
|