[Olsr-dev] Broken TIME_DUE macro

Henning Rogge (spam-protected)
Tue Nov 17 16:54:16 CET 2009


Am Dienstag 17 November 2009 12:21:58 schrieb Jernej Kos:
> Hi,
> 
> while writing a plugin for olsrd (version 0.5.6-r5) I noticed that the
> TIME_DUE macro defined in src/defs.h doesn't actually work properly. The
> macro is as follows:
> 
> #define TIME_DUE(s1)   ((int)((s1) * olsr_cnf->system_tick_divider) -
> now_times)
> 
> But this is incorrect as s1 is a timestamp and is already in system
> ticks. So the order of operations is wrong, one would need to first
> subtract now_times and then multiply by system_tick_divider to get the
> actual miliseconds like this:
> 
> #define TIME_DUE(s1) ((int)((s1 - now_times) *
> olsr_cnf->system_tick_divider))
> 
> I have redefined it in my plugin, but have noticed that this macro is
> used in update_link_entry (link_set.c) to calculate some timer duration
> and might therefore cause some problems over there.
Most likely you missunderstood the macro (or the comment in the header file 
was wrong), but I will look at the issue.

Henning
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.olsr.org/pipermail/olsr-dev/attachments/20091117/457ef82b/attachment.sig>


More information about the Olsr-dev mailing list