Entries in .net (1)

Tuesday
May052009

Check that Source code you get from the Internet.

I was looking at a page that did some timings of an API we use here at work and noticed that it was showing ms (milliseconds) rather than s (seconds).   It reminded me a bit of Verizon math as it was fairly obvious that these timings were completing in about 6 seconds and not 6 milliseconds.  I sent an email to my colleague who wrote the page and he indicated he had used it from a comment on a post at Scott Hanselman's site.  I noticed that the code there was using the kernel methods QueryPerformanceCounter and QueryPerformanceFrequency so I looked them up in MSDN and found that the QueryPerformanceFrequency was a count per second and not count per millisecond and that the code in the comment was wrong (formatted wrong).  Scott had long since closed the comments on this post and since I didn't have a way of pointing out the error at that source and with Scott's encouragement, I am writing this blog post.

Click to read more ...