-
DateTime weird
Trying to estimate when a test will end
Code:
DateTime EndTime = new DateTime(DateTime.Now.Ticks + NTests * 20000000);
This gives me an end time lower than DateTime.Now !?!? Thought it was caused by long overflow, but no result is lower than 9,223,372,036,854,775,807. Any idea what might be wrong here ?
-
Re: DateTime weird
Why will you need Ticks? Its nanoseconds from 1970. Why will you add to that? You can simply take the current time and if you know Ntests and how much time each test takes, then that can be added to current time.
-
Re: DateTime weird
Actually a single tick is 100 nano secs based on MSDN and ist from the start of the century not 1970.
-
Re: DateTime weird
How are you determining that it is lower than DateTime.Now (and which "now" do you mean?)
-
Re: DateTime weird
Explain what you are trying to calculate... Not at all clear?
-
Re: DateTime weird
Any chance you're testing along the lines of: DateTime.Now < EndTime?
Because, that "Now" is a new "Now", and not the original "Now". :D
If so, you need to store the result of DateTime.Now the first time you call it, and check against that.