<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=FR link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Right, my mistake.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Then, the only thing that we actually need is to use the “double”
type.<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>The other change you propose would make it possible to go over
the 209 year limit. I won’t be there to see it being reached so it’s
fine for me </span><span lang=EN-US style='font-size:11.0pt;font-family:Wingdings;
color:#1F497D'>J</span><span lang=EN-US style='font-size:11.0pt;font-family:
"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Thanks for your help<o:p></o:p></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p> </o:p></span></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt'>
<div>
<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>
<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> Wesley W. Terpstra
[mailto:wesley@terpstra.ca] <br>
<b>Sent:</b> Tuesday, July 21, 2009 4:20 PM<br>
<b>To:</b> Nicolas Bertolotti<br>
<b>Cc:</b> mlton@mlton.org<br>
<b>Subject:</b> Re: [MLton] Problem with recent implementation of
gettimeofday() on MinGW<o:p></o:p></span></p>
</div>
</div>
<p class=MsoNormal><o:p> </o:p></p>
<div>
<p class=MsoNormal>On Tue, Jul 21, 2009 at 3:01 PM, Nicolas Bertolotti <<a
href="mailto:Nicolas.Bertolotti@mathworks.fr">Nicolas.Bertolotti@mathworks.fr</a>>
wrote:<o:p></o:p></p>
<div>
<div>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'>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><o:p></o:p></p>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'> </span><o:p></o:p></p>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'>I could not identify
the exact location of the overflow by looking at the code. I suspect the
instruction:</span><o:p></o:p></p>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'>nowMicroSeconds.QuadPart
+=</span><o:p></o:p></p>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'>
1000000 * deltaCounter.QuadPart / frequency.QuadPart;</span><o:p></o:p></p>
<p><span lang=EN-US style='font-size:11.0pt;color:#1F497D'>But, in my point of
view, it could only lead to a failure if the call occurs after
(0xFFFFFFFFFFFFFFFFULL / 10000ULL) / 0xA6E78230ULL = 658767 seconds.</span><o:p></o:p></p>
</div>
</div>
</div>
<p class=MsoNormal style='margin-bottom:12.0pt'>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.<o:p></o:p></p>
</div>
</div>
</body>
</html>