<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style></head>
<body>
<body><p dir="ltr">Depending on what it is doing, using time fire after might be a better option.</p><div class="quote">On Dec 20, 2013 1:52 PM, "Claus, Ric" <claus@slac.stanford.edu> wrote:<br type="attribution"></div></body>
<font size="2"><div class="PlainText">A program that I’m trying to make compatible with RTEMS (iperf 2.0.5) uses the posix function setitimer(), which has only a trivial implementation under RTEMS. I modified the code as follows:<br>
<br>
if ( mMode_Time ) {<br>
memset (&it, 0, sizeof (it));<br>
it.it_value.tv_sec = (int) (mSettings->mAmount / 100.0);<br>
it.it_value.tv_usec = (int) 10000 * (mSettings->mAmount -<br>
it.it_value.tv_sec * 100.0);<br>
#ifndef __rtems__<br>
err = setitimer( ITIMER_REAL, &it, NULL );<br>
if ( err != 0 ) {<br>
perror("setitimer");<br>
exit(1);<br>
}<br>
#else<br>
FAIL (mSettings->mAmount > UINT_MAX / 10000, "ualarm", mSettings);<br>
<br>
ualarm(mSettings->mAmount * 10000, 0);<br>
#endif<br>
}<br>
<br>
If implementing setitimer( ITIMER_REAL, … ) with ualarm() is a valid thing to do (please comment), would it be useful for me to provide a patch to setitimer() that operates this way? I’m not sure whether in this scenario the alarm must be cancelled with alarm(0, 0) later or not, but that would prevent this from being a generic solution.<br>
<br>
Cheers,<br>
Ric<br>
_______________________________________________<br>
rtems-devel mailing list<br>
rtems-devel@rtems.org<br>
<a href="http://www.rtems.org/mailman/listinfo/rtems-devel">http://www.rtems.org/mailman/listinfo/rtems-devel</a><br>
</div></font>
</body>
</html>