1234567891011121314151617181920 |
- using System.Diagnostics;
- namespace Aip.Service.Utils;
- public static class TimeUtils
- {
- public static int GetElapsedMilliseconds(DateTime start, DateTime end)
- {
- TimeSpan timeDiff = start - end;
- return timeDiff.Milliseconds;
- }
- public static long GetElapsedMilliseconds(long start, long stop)
- {
- return (long)((stop - start) * 1000 / (double)Stopwatch.Frequency);
- }
- public static long GetElapsedMilliseconds(long start)
- {
- return (long)((Stopwatch.GetTimestamp() - start) * 1000 / (double)Stopwatch.Frequency);
- }
- }
|