Dear Andreas,
On 23.01.2014 11:53, Andreas Eversberg wrote:
0008-Fixed-nanoBTS-delay-problems-if-RTP-stream-jitters-t.patch
@@ -244,13 +250,62 @@ static void tv_difference(struct timeval *diff, const struct
timeval *from,
...
Is there a reason why you are not using the BSD macros timersub and
timeradd (beside the new support for denormalized usec values)?
+/* add sec,usec to tv */
+static void tv_add(struct timeval *tv, int sec, int usec)
+{
+
+ while (usec < 0) {
+ usec += USEC_1S;
+ sec--;
+ }
+ tv->tv_sec += sec;
+ tv->tv_usec += usec;
+ while (tv->tv_usec >= USEC_1S) {
+ tv->tv_sec++;
+ tv->tv_usec -= USEC_1S;
+ }
+}
I'm not sure whether it is a good idea to use while loops in this case
since CPU usage is O(N) of the usec value.
Wouldn't it be more convenient to have a function tv_add_us(tv, usec)
instead that does the div/mod stuff to a temporary timeval and then just
calls timeradd()?
Cheers
Jacob