<div class="gmail_quote">On Tue, Jul 21, 2009 at 3:01 PM, Nicolas Bertolotti <span dir="ltr"><<a href="mailto:Nicolas.Bertolotti@mathworks.fr">Nicolas.Bertolotti@mathworks.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="FR">
<div><p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">I have a binary which ran for 12783 seconds and calls Time.now()
once at the beginning of its execution and once at the end of its execution.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US"> </span></p><p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">I could not identify the exact location of the overflow by looking
at the code. I suspect the instruction:</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">nowMicroSeconds.QuadPart +=</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">
1000000 * deltaCounter.QuadPart / frequency.QuadPart;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);" lang="EN-US">But, in my point of view, it could only lead to a failure if the
call occurs after (0xFFFFFFFFFFFFFFFFULL / 10000ULL) / 0xA6E78230ULL = 658767
seconds.</span></p></div></div></blockquote></div>Actually, it would be 2^63/10^6/0xa6e78230 = 3294 seconds. That corresponds to what you saw. I'll note that your clock's frequency is significantly higher than mine!<br>
<br>My patch uses a double there now which definitely has enough precision. Even with your faster clock rate, the QueryPerformanceCounter won't wrap around for 209 years, so the overly anal check comparing the high resolution timer to the low resolution timer is unnecessary... Still, perhaps other systems have an even faster clock.<br>
<br>