
1 2 3 4 5 6 7 8 9 10 11 12 13 | // clock the start time DateTime start_time = DateTime.Now; // To-do: Add you process here. // clock the end time DateTime end_time = DateTime.Now; // get total seconds spend on the process var total_seconds = (end_time - start_time).TotalSeconds; // print the output Console.WriteLine("Total seconds spent: {0}", total_seconds); |
Get total seconds in C#