J
Jon Skeet [C# MVP]
Jeroen CEuppens said:Hi, I want to measure a time (in ticks) between a couple of operations, with
these code:
long voor = DateTime.Now.TimeOfDay.Ticks;
bmp1 = new Bitmap(@"\Network\im\ImageWeftIllum.bmp");
bmp2 = new Bitmap(@"\Network\im\ImageWarpIllum.bmp");
g.DrawImage( bmp1, 0, 0 );
g.DrawImage( bmp2, 1, 1 );
long na = DateTime.Now.TimeOfDay.Ticks;;
na=na-voor;
textBoxTijd.Text=na.ToString()+" ticks";
Firstly, I'd just use:
DateTime voor = DateTime.Now;
....
DateTime na = DateTime.Now;
TimeSpan diff = na-voor;
and then use the results of that. However...
The textBoxTijd only gives something like this: 2000 000 ticks or 3000 000
ticks, but never something like 3333 325, what's the problem? I also put
more operations between the measuring, but always some stuff like that: 2000
000 33 000 000, help me pleae
I debug on a Win CE 4.2
The Pocket PC timer is very coarse - ie it doesn't update very often. I
suspect you would still see multiples of ticks even on a desktop
system, but with a Pocket PC it'll be more pronounced.