A
Alain Dekker
I've written this code:
long lStart = DateTime.Now.Ticks;
....
DoLongComplexTask();
....
decimal dElapsed = (((decimal)DateTime.Now.Ticks - (decimal)lStart) /
10000000.0m);
lbDiagnostic.Text = ("Time taken: " + dElapsed.ToString("0.000") + "s");
But all I ever get is one of these two:
"Time taken: 5.000s" or "Time taken: 6.000s"
no matter how many times I try. This is weird. Why nothing after the
seconds? I should have varying number of milliseconds, but it seems to be
rounded. Is this a coding bug or is there something like the GetTickCount()
I used to use in Delphi/C++ that I can use that is more accurate than
DateTime.Now.Ticks (which I note that documentation claims is accuracte to
100ns - not in my experience!).
I'm writing the application in VS 2005, targetting the CF .NET 2.0 on
Windows CE if thats relevant.
Thanks,
Alain
long lStart = DateTime.Now.Ticks;
....
DoLongComplexTask();
....
decimal dElapsed = (((decimal)DateTime.Now.Ticks - (decimal)lStart) /
10000000.0m);
lbDiagnostic.Text = ("Time taken: " + dElapsed.ToString("0.000") + "s");
But all I ever get is one of these two:
"Time taken: 5.000s" or "Time taken: 6.000s"
no matter how many times I try. This is weird. Why nothing after the
seconds? I should have varying number of milliseconds, but it seems to be
rounded. Is this a coding bug or is there something like the GetTickCount()
I used to use in Delphi/C++ that I can use that is more accurate than
DateTime.Now.Ticks (which I note that documentation claims is accuracte to
100ns - not in my experience!).
I'm writing the application in VS 2005, targetting the CF .NET 2.0 on
Windows CE if thats relevant.
Thanks,
Alain