[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] SNTP
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] SNTP |
Date: |
Tue, 04 May 2010 12:26:27 +0200 |
"Bernhard \'Gustl\' Bauer" wrote:
> 'timers.c' was not included in LWIP 1.3.2 - is this correct? I plan to
> add it to my port.
>
> There is sys_now() needed for this. I don't think it must return system
> time. A ms counter would be ok, wouldn't it.
Yes.
> A problem would be wrap around. It would happen after 49 days (I
> remember win95 crashing after this period). Here a code snippet how I
> would do it:
That's a problem currently, yes. It's planned to be fixed with 1.4.0 as the
NO_SYS=0 timers will have to be altered, too. I've just added a bug tracker
entry so that it will not get forgotten again.
>
> void
> sys_check_timeouts(void)
> {
> struct sys_timeo *tmptimeout;
> u32_t diff;
> sys_timeout_handler h;
> void *arg;
> int had_one;
> u32_t now;
> #if LWIP_DEBUG_TIMERNAMES
> const char *handler_name;
> #endif /* LWIP_DEBUG_TIMERNAMES */
>
> now = sys_now();
> if (next_timeout) {
> /* @todo: wrap around? */
> // --------- new code
> if (now < timeouts_last_time)
> diff = ( 0xFFFFFFFF - timeouts_last_time ) + now + 1 ;
> else
> // --------- end of new code
> diff = now - timeouts_last_time;
>
>
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
--
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01