示例#1
0
        /// <summary>
        /// Returns elapsed time, calculated as (end - begin) if both are defined or
        /// (now - begin) if end is undefined or 0 if both are undefined.
        /// </summary>
        /// <remarks>
        /// Returns elapsed time, calculated as (end - begin) if both are defined or
        /// (now - begin) if end is undefined or 0 if both are undefined.  Begin and end
        /// time may come from different AbstractTracking instances.
        /// </remarks>
        /// <param name="beginTracking">AbstractTracking containing begin time</param>
        /// <param name="endTracking">AbstractTracking containing end time</param>
        /// <returns>long elapsed time</returns>
        private long GetElapsedTime(AbstractTracking beginTracking, AbstractTracking endTracking
                                    )
        {
            long elapsed;

            if (beginTracking != null && beginTracking.beginTime != long.MinValue && endTracking
                != null && endTracking.endTime != long.MinValue)
            {
                elapsed = endTracking.endTime - beginTracking.beginTime;
            }
            else
            {
                if (beginTracking != null && beginTracking.beginTime != long.MinValue)
                {
                    elapsed = Time.MonotonicNow() - beginTracking.beginTime;
                }
                else
                {
                    elapsed = 0;
                }
            }
            return(Math.Max(0, elapsed));
        }
示例#2
0
 /// <summary>
 /// Subclass instances may call this method during cloning to copy the values of
 /// all properties stored in this base class.
 /// </summary>
 /// <param name="dest">AbstractTracking destination for copying properties</param>
 protected internal virtual void Copy(AbstractTracking dest)
 {
     dest.beginTime = beginTime;
     dest.endTime   = endTime;
 }
示例#3
0
 /// <summary>
 /// Returns elapsed time, calculated as (end - begin) if both are defined or
 /// (now - begin) if end is undefined or 0 if both are undefined.
 /// </summary>
 /// <remarks>
 /// Returns elapsed time, calculated as (end - begin) if both are defined or
 /// (now - begin) if end is undefined or 0 if both are undefined.  Begin and end
 /// time come from the same AbstractTracking instance.
 /// </remarks>
 /// <param name="tracking">AbstractTracking containing begin and end time</param>
 /// <returns>long elapsed time</returns>
 private long GetElapsedTime(AbstractTracking tracking)
 {
     return(GetElapsedTime(tracking, tracking));
 }