|
From: | Fotis Panagiotopoulos |
Subject: | Re: [lwip-users] Timeout wraparound bug |
Date: | Sat, 18 Feb 2017 13:55:41 +0200 |
Mechatronics Engineer
AMCO Α.Β.Ε.Ε.
Αμφιαράου
25,, Τ.Κ.
104 42, Αθήνα,
Ελλάδα
Τηλ
: +30 210 5907000 – ext. 28 | Fax: +30 210 5912711
e-mail: address@hidden | web:
http://www.amco.gr
---------------------------------------------------------------------------
Please consider the environment before printing this e-mail.Nope, the difference will be preserved by type promotion, unless the wrap around occurs more than once between calls or the counter counted more than half length counts (which also includes the former...).
Are you calling frequently enough sys_check_timeouts() ?
You should (read 'must').
Otherwise, you have a compiler problem, try this:
#include <stdio.h>
#include <stdint.h>
uint32_t now = 1;
uint32_t timeouts_last_time = 0xFFFFFFFF;
main()
{
uint32_t diff = now - timeouts_last_time;
printf("%u\n",diff);
if((now - timeouts_last_time) > 2)
printf("Oops\n");
else
printf("OK\n");
}
$ ./td
2
OK
_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users
[Prev in Thread] | Current Thread | [Next in Thread] |