<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><div><span class="719273517-05112012"><font size="2"><font face="Arial">Thank you very
much for your answer. Your words make sense concerning the
calculation!</font> </font></span></div>
<div><font face="Arial"><font size="2"><font color="#0000ff">There were two different
(independent) problems:</font></font></font></div>
<div><font face="Arial"><font size="2"><font color="#0000ff"><span class="719273517-05112012"><font>1 the underlined line returns 0
on Freescale's I.MX53 ARM cpu, the reason: </font> </span><span class="719273517-05112012"> </span><span class="719273517-05112012"> "<font face="Courier New">fTimestampFrequency*tv.tv_usec" <font face="Arial">is too large
for 32bit. As the datatype of "timestampIncrement" is u_int32_t the calculation
is performed with 32 bit width. On a 64bit PC this seems not to be a problem
because it calculates automatically with 64bit. The fix for this is to use a
u_int64_t </font></font></span></font></font></font></div></div></blockquote><div><br></div>No, that shouldn't be necessary. The following should overcome the problem:</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>timestampIncrement += (u_int32_t)(fTimestampFrequency*(tv.tv_usec/1000000.0) + 0.5);</div><div><br></div><div>because the calculation will be done with floats, but then converted to a "u_int32_t" at the end - without any overflow.</div><div><br></div><div>(2.0*fTimestampFrequency*tv.tv_usec + 1000000.0)/2000000);</div><div><br></div><div><br><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><div><span style="font-size: small; font-family: Arial; ">2</span><span class="719273517-05112012" style="font-size: small; font-family: Arial; "> in the gettimeofday function in
GroupSockHelper.cpp (line 700):</span></div>
<div><span class="719273517-05112012"></span><span class="719273517-05112012"><font size="2" face="Arial"> Theres a define for WinCE, but
unfortunately the WinCE version oft gettimeofday is not working properly, I
assume that it wasn't tested?</font></span></div></div></blockquote><div><br></div>I don't (and will never) use WinCE myself, so any contributions of WinCE-specific code - such as this - have come from other WinCErs. I have to trust that it works.</div><div><br></div><div><br><blockquote type="cite"><div style="WORD-WRAP: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space"><div><span class="719273517-05112012"><font size="2" face="Arial"> You can find alot occurences of this problem in
WinCE world. The problem is the "GetSystemTime()" call, which should fill the
SYSTEMTIME struct, but it does not, at least not the milliseconds field (which
is always 0). The solution I used:</font></span></div>
<div><span class="719273517-05112012"><font size="2" face="Arial"></font></span> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New">int
gettimeofday(struct timeval* tp, int* /*tz*/) {<br>#if
defined(_WIN32_WCE)<br> /* FILETIME of Jan 1 1970 00:00:00. */<br>
static const unsigned __int64 epoch = 116444736000000000LL;<br> static
Boolean isFirstCall = True;<br> static LONGLONG unixStartTime =
0;<br> static DWORD firstTickCount=0;</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> if
(isFirstCall) {</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> FILETIME fileTime;</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New">
GetSystemTimeAsFileTime(&fileTime);</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> LARGE_INTEGER date;<br>
date.HighPart = fileTime.dwHighDateTime;<br> date.LowPart =
fileTime.dwLowDateTime;</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> unixStartTime= (date.QuadPart - epoch) /
10000000L;</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> firstTickCount =
GetTickCount();</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New">
tp->tv_sec=(long)unixStartTime;<br> tp->tv_usec=
0L;</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> isFirstCall = False; // for next
time</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New"> }
else {<br> // add elapsed seconds<br>
tp->tv_sec= (long)unixStartTime +
(GetTickCount()-firstTickCount)/1000;<br>
tp->tv_usec=(GetTickCount()-firstTickCount)%1000 *
1000;<br>}</font></span></div>
<div><font face="Courier New"></font> </div>
<div><span class="719273517-05112012"><font size="2" face="Courier New">#else</font></span></div></div></blockquote><div><br></div></div>OK, I'll make both these changes in the next release of the software.<br><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">Ross Finlayson<br>Live Networks, Inc.<br><a href="http://www.live555.com/">http://www.live555.com/</a></span></span>
</div>
<br></body></html>