Time - Time-interval Measurements

public class TimeHelper
{
    private long _start, _stop, _elapsed;

    /// <summary>
    /// 获取初始时间戳
    /// </summary>
    public void start()
    {
        _start = Stopwatch.GetTimestamp();
    }

    /// <summary>
    /// 获取终结时间戳
    /// </summary>
    public void stop()
    {
        _stop = Stopwatch.GetTimestamp();
    }

    /// <summary>
    /// 获取高精度时间间隔
    /// </summary>
    /// <returns></returns>
    public double getTimeInteval()
    {
        return (_stop - _start) * (1.0 / Stopwatch.Frequency);
    }
}
posted @ 2018-12-18 10:22  郑大峰  阅读(265)  评论(0编辑  收藏  举报