<html>

<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:"Cambria Math";
        panose-1:0 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;}
span.E-MailFormatvorlage17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 2.0cm 70.85pt;}
div.WordSection1
        {page:WordSection1;}
-->
</style>

</head>

<body lang="DE" link="blue" vlink="purple">

<div class="WordSection1">

<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;">I
do not see any way, an overflow would make any problems for subtracting two signed
int, the result is still correct, but an overflow does indeed lead to problems.
Actually the double amount for positive values of an unsigned is only relevant
for absolute times, not differences between two times, as all differences greater
than 24 hours are treated as an overflow by time.h macros anyway, so I think,
you could simply interpret the bytes as unsigned int, if passing it to a 3rd
party time library, but interpreting it as signed, when comparing timestamps. The
absolute value of a single timestamp without comparing it to a second one would
rarely be of any use, as even unsigned int overflows every 1,5 months.</span></p>

<p class="MsoNormal"><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,&quot;sans-serif&quot;;
color:#1F497D"> </span></p>

<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:&quot;Tahoma&quot;,&quot;sans-serif&quot;">Von:</span></b><span style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,&quot;sans-serif&quot;">
<a href="mailto:enet-discuss-bounces@cubik.org">enet-discuss-bounces@cubik.org</a> [mailto:<a href="mailto:enet-discuss-bounces@cubik.org">enet-discuss-bounces@cubik.org</a>] <b>Im
Auftrag von </b>Nuno Silva<br>
<b>Gesendet:</b> Donnerstag, 22. Juli 2010 17:10<br>
<b>An:</b> Discussion of the ENet library<br>
<b>Betreff:</b> Re: [ENet-discuss] time.h</span></p>

</div>

<p class="MsoNormal"> </p>

<p class="MsoNormal" style="margin-bottom:12.0pt">Sorry for double-messaging, but
i need to rephrase what i said: unsigned int has twice as many possible values
than signed int and a signed int would cause overflows more often than unsigned
int.</p>

<div>

<p class="MsoNormal">On Thu, Jul 22, 2010 at 4:09 PM, Nuno Silva &lt;<a href="mailto:little.coding.fox@gmail.com">little.coding.fox@gmail.com</a>&gt;
wrote:</p>

<p class="MsoNormal" style="margin-bottom:12.0pt">Problem is that unsigned int
has more storage for positive values than signed int (by about half), not to
mention all time libraries and specifications go with unsigned values too.</p>

<div>

<div>

<div>

<p class="MsoNormal">On Thu, Jul 22, 2010 at 4:02 PM, Stefan Ludewig &lt;<a href="mailto:stefan.ludewig@exitgames.com" target="_blank">stefan.ludewig@exitgames.com</a>&gt;
wrote:</p>

</div>

</div>

<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm">

<div>

<div>

<div>

<div>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hi
all.</p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> </p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">What is the reason enet uses unsigned int and these time overflow
macros in time.h?</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">I enet would simply use signed int, these macros would not be needed
at all.</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">For example if we have a time INT_MAX and a second one INT_MIN , 1ms
later, directly after the overflow, INT_MIN-INT_MAX would result in the correct
difference 1 and INT_MAX-INT_MIN in the correct difference -1. No need for the
use of ENET_TIME_DIFFERENCE at all for signed int.</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">On the other hand, if we call ENET_TIME_DIFFERENCE(a, b) with a==1
and b==2, the result is b-a -&gt; 1, although the correct result would have
been -1.</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">If some functions need unsigned times or return unsigned times, you
could simply them from/to signed int, and all would be fine.</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">So I do not see any advantage in using unsigned int and time.h
macros instead of simply use signed int. Can you tell me the reasons for the
unsigned + time.h solution?</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Thx,</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US">Stefan.</span></p>

<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span lang="EN-US"> </span></p>

</div>

</div>

<p class="MsoNormal"> </p>

</div>

</div>

<p class="MsoNormal" style="margin-bottom:12.0pt">_______________________________________________<br>
ENet-discuss mailing list<br>
<a href="mailto:ENet-discuss@cubik.org" target="_blank">ENet-discuss@cubik.org</a><br>
<a href="http://lists.cubik.org/mailman/listinfo/enet-discuss" target="_blank">http://lists.cubik.org/mailman/listinfo/enet-discuss</a></p>

</blockquote>

</div>

<p class="MsoNormal"> </p>

</div>

<p class="MsoNormal"> </p>

</div>

</body>

</html>