Calculates the elapsed time by subtracting the start time from the time of the call. - CSharp System

CSharp examples for System:DateTime

Description

Calculates the elapsed time by subtracting the start time from the time of the call.

Demo Code


using System;/* ww w. j a  v  a  2 s  .com*/

public class Main{
        /// <summary>
        /// Calculates the elapsed time by subtracting the start time from the time of the call.
        /// </summary>
        /// <param name="startTime">The time to substract.</param>
        /// <returns>The elapsed time.</returns>
        public static int CalculateElapsedTime(int startTime)
        {
            return DateTime.Now.Millisecond - startTime;
        }
}

Related Tutorials