Elapsed time
-
This one took a while to figure out:
TimeSpan elapsed = DateTime.Now - lastoutput;
return elapsed.Milliseconds;mainly because it made so much sense reading it in English. Yeah, I want the elapsed milliseconds, right? But that's not what I'm getting! Why? Do I really need to post the answer to this one? ;) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith -
This one took a while to figure out:
TimeSpan elapsed = DateTime.Now - lastoutput;
return elapsed.Milliseconds;mainly because it made so much sense reading it in English. Yeah, I want the elapsed milliseconds, right? But that's not what I'm getting! Why? Do I really need to post the answer to this one? ;) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh SmithDoesn't TimeSpan keep track of seconds that have elapsed? The .Milleseconds would just be a number between 0 and 999 and represent some very small part of the total elapsed time. :)
Chris Meech I am Canadian. [heard in a local bar] I agree with you that my argument is useless. [Red Stateler] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
-
Doesn't TimeSpan keep track of seconds that have elapsed? The .Milleseconds would just be a number between 0 and 999 and represent some very small part of the total elapsed time. :)
Chris Meech I am Canadian. [heard in a local bar] I agree with you that my argument is useless. [Red Stateler] Hey, I am part of a special bread, we are called smart people [Captain See Sharp] The zen of the soapbox is hard to attain...[Jörgen Sigvardsson] I wish I could remember what it was like to only have a short term memory.[David Kentley]
Chris Meech wrote:
The .Milleseconds would just be a number between 0 and 999 and represent some very small part of the total elapsed time.
Exactly. So what I really wanted to return was .TotalMilliseconds. :) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith -
Chris Meech wrote:
The .Milleseconds would just be a number between 0 and 999 and represent some very small part of the total elapsed time.
Exactly. So what I really wanted to return was .TotalMilliseconds. :) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh SmithYep, I saw that.
-
This one took a while to figure out:
TimeSpan elapsed = DateTime.Now - lastoutput;
return elapsed.Milliseconds;mainly because it made so much sense reading it in English. Yeah, I want the elapsed milliseconds, right? But that's not what I'm getting! Why? Do I really need to post the answer to this one? ;) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh SmithI have also comitted the same mistake! :-O Sometimes you cannot just rely on the method or the property name.
-
This one took a while to figure out:
TimeSpan elapsed = DateTime.Now - lastoutput;
return elapsed.Milliseconds;mainly because it made so much sense reading it in English. Yeah, I want the elapsed milliseconds, right? But that's not what I'm getting! Why? Do I really need to post the answer to this one? ;) Marc
People are just notoriously impossible. --DavidCrow
There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer
People who say that they will refactor their code later to make it "good" don't understand refactoring, nor the art and craft of programming. -- Josh Smith:laugh: I did that on the first pass through a quick addon to some automated test cases. These particular test cases were dealing in core areas of my design, and were dealing with carefully constructed test data sets, and I figured it's be nifty to also throw in some data about time spent in the test case. My first reaction to the times were Holy crap that's fast! I rule!. Then it hit me that the test case which apparently took just under 200 milliseconds was accessing an amount of data from disk that simply could not be read from disk in that timeframe, let alone fully processed. I ran it a few more times, and then it dawned on me :)