[Olsr-dev] Broken TIME_DUE macro

Jernej Kos (spam-protected)
Tue Nov 17 12:21:58 CET 2009


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) -

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) *

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.

Best regards,
Jernej Kos.
Jernej Kos <(spam-protected)>
-------------- 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/443fb742/attachment.sig>

More information about the Olsr-dev mailing list