GifRecorder/Util/Benchmark.cs

(完整代码) 774B

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScreenToGif.Util
{
    /// <summary>
    /// Util to calculate the timeSpan diff between two parts of the code. 
    /// </summary>
    public class Benchmark
    {
        private static DateTime startDate = DateTime.MinValue;
        private static DateTime endDate = DateTime.MinValue;

        public static TimeSpan Span { get { return endDate.Subtract(startDate); } }

        public static void Start() { startDate = DateTime.Now; }

        public static void End() { endDate = DateTime.Now; }

        public static double GetSeconds()
        {
            if (endDate == DateTime.MinValue) return 0.0;
            else return Span.TotalSeconds;
        }
    }
}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。