Timer
-
Can anyone tell me how do I count the number of seconds elapsed after a certain piece of C# code is executed?
-
Can anyone tell me how do I count the number of seconds elapsed after a certain piece of C# code is executed?
I would create something to hold a start time. And then when I need to know the number of elapsed seconds I'd get the current time and calculate the difference.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog
-
I would create something to hold a start time. And then when I need to know the number of elapsed seconds I'd get the current time and calculate the difference.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question." --Charles Babbage (1791-1871) My: Website | Blog
What do i need to write to get the start time and stop time?
-
Can anyone tell me how do I count the number of seconds elapsed after a certain piece of C# code is executed?
what do i need to write to get the start time and stop time?
-
Can anyone tell me how do I count the number of seconds elapsed after a certain piece of C# code is executed?
DateTime - DateTime = TimeSpan ;)
DateTime start = DateTime.Now; DoSomething(); TimeSpan result = DateTime.Now - start; Console.WriteLine(result.Seconds);
_________________________________ Please inform me about my English mistakes, as I'm still trying to learn your language! -
Can anyone tell me how do I count the number of seconds elapsed after a certain piece of C# code is executed?