buglwIP - A Lightweight TCP/IP stack - Bugs: bug #36905, SNTP problem with...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #36905: SNTP problem with SNTP_STARTUP_DELAY symbol

Submitter:  Freddie Chopin <freddie_chopin>
Submitted:  Fri 20 Jul 2012 07:04:15 PM UTC
   
 
Category:  Contrib Severity:  3 - Normal
Item Group:  Faulty Behaviour Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.4.0

Mon 13 Aug 2012 07:44:04 PM UTC, comment #1: 

Fixed by adding a new optional macro SNTP_STARTUP_DELAY_FUNC.

Simon Goldschmidt <goldsimon>
Group administrator
Fri 20 Jul 2012 07:04:15 PM UTC, original submission:  

This is about file sntp.c

When I try to define SNTP_STARTUP_DELAY symbol as any function (let that be rand()) it gives me compiler error:

lwIP/lwIP_Apps/apps/sntp/sntp.c: In function 'sntp_init':
lwIP/lwIP_Apps/apps/sntp/sntp.c:696:5: error: missing binary operator before token "("

on line:

#if SNTP_STARTUP_DELAY

The solution I've found is to define the symbol as a numeric non-zero value (for the "#if") and add another symbol SNTP_STARTUP_DELAY_FUNC used in this line:

sys_timeout((u32_t)SNTP_STARTUP_DELAY_FUNC, sntp_request, NULL);

This way I have two defines:

#ifndef SNTP_STARTUP_DELAY
#define SNTP_STARTUP_DELAY          rand
#define SNTP_STARTUP_DELAY_FUNC ((rand() % (4 60 1000)) + (60 * 1000))
#endif

I don't know whether it's possible to use current code and define original symbol to be some function - probably not.

Freddie Chopin <freddie_chopin>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by freddie_chopin (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-08-13 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code