Skip to content

Remove duplication and incompatible declarations in sntp.h #6610

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions libraries/esp8266/examples/NTP-TZ-DST/NTP-TZ-DST.ino
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,7 @@
#include <time.h> // time() ctime()
#include <sys/time.h> // struct timeval

#if LWIP_VERSION_MAJOR == 1
#include <lwip/sntp.h> // sntp_servermode_dhcp()
#else
#include <lwip/apps/sntp.h> // sntp_servermode_dhcp()
#endif
#include <sntp.h> // sntp_servermode_dhcp()

// for testing purpose:
extern "C" int clock_gettime(clockid_t unused, struct timespec *tp);
Expand Down
47 changes: 2 additions & 45 deletions tools/sdk/include/sntp.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@

#include "lwip/init.h"
#include "lwip/ip_addr.h"

#if LWIP_VERSION_MAJOR == 1
#define ipv4_addr_t ip_addr_t
#include "lwip/sntp.h"
#else
typedef struct ip4_addr ipv4_addr_t;
#include "lwip/apps/sntp.h"
#endif

#ifdef __cplusplus
Expand All @@ -32,48 +31,6 @@ sint8 sntp_get_timezone(void);
* SNTP set time_zone (default GMT + 8)
*/
bool sntp_set_timezone(sint8 timezone);
/**
* Initialize this module.
* Send out request instantly or after SNTP_STARTUP_DELAY(_FUNC).
*/
void sntp_init(void);
/**
* Stop this module.
*/
void sntp_stop(void);
/**
* Initialize one of the NTP servers by IP address
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS
* @param dnsserver IP address of the NTP server to set
*/
void sntp_setserver(unsigned char idx, ipv4_addr_t *addr);
/**
* Obtain one of the currently configured by IP address (or DHCP) NTP servers
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or "ipv4_addr_any" if the NTP
* server has not been configured by address (or at all).
*/
ipv4_addr_t sntp_getserver(unsigned char idx);
/**
* Initialize one of the NTP servers by name
*
* @param numdns the index of the NTP server to set must be < SNTP_MAX_SERVERS,now sdk support SNTP_MAX_SERVERS = 3
* @param dnsserver DNS name of the NTP server to set, to be resolved at contact time
*/
void sntp_setservername(unsigned char idx, char *server);
/**
* Obtain one of the currently configured by name NTP servers.
*
* @param numdns the index of the NTP server
* @return IP address of the indexed NTP server or NULL if the NTP
* server has not been configured by name (or at all)
*/
char *sntp_getservername(unsigned char idx);

#define sntp_servermode_dhcp(x)


#ifdef __cplusplus
}
Expand Down