Skip to content

Commit 2c38c45

Browse files
committed
rebase time.c
1 parent 5b92569 commit 2c38c45

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

cores/esp8266/time.c

+3-4
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ extern uint64_t micros64();
3636
// time gap in seconds from 01.01.1900 (NTP time) to 01.01.1970 (UNIX time)
3737
#define DIFF1900TO1970 2208988800UL
3838

39-
static int s_daylightOffset_sec = 0;
40-
static long s_timezone_sec = 0;
4139
static bool s_bootTimeSet = false;
4240
static uint64_t s_bootTime_us = 0;
4341

@@ -73,9 +71,10 @@ void configTime(int timezone, int daylightOffset_sec, const char* server1, const
7371
setServer(1, server2);
7472
setServer(2, server3);
7573

76-
s_timezone_sec = timezone;
77-
s_daylightOffset_sec = daylightOffset_sec;
74+
//s_timezone_sec = timezone;
75+
//s_daylightOffset_sec = daylightOffset_sec;
7876
sntp_set_timezone(timezone/3600);
77+
sntp_set_daylight(daylightOffset_sec);
7978
sntp_init();
8079
}
8180

tools/sdk/lib/liblwip2.a

1.67 KB
Binary file not shown.

tools/sdk/lwip2/include/arch/cc.h

+9-3
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,17 @@ extern "C"
5151
#ifdef __cplusplus
5252
}
5353
#endif
54-
55-
void sntp_set_system_time (uint32_t t);
56-
5754
#endif // defined(LWIP_BUILD)
5855

56+
#ifdef __cplusplus
57+
extern "C"
58+
{
59+
#endif
60+
void sntp_set_system_time (uint32_t t); // also provided to user
61+
#ifdef __cplusplus
62+
}
63+
#endif
64+
5965
#include "mem.h" // useful for os_malloc used in esp-arduino's mDNS
6066

6167
typedef uint32_t sys_prot_t; // not really used

tools/sdk/lwip2/include/lwipopts.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -2986,7 +2986,10 @@
29862986
--------------------------------------------------
29872987
*/
29882988
#define SNTP_SERVER_DNS 1 // SNTP support DNS names through sntp_setservername / sntp_getservername
2989-
#define SNTP_SERVER_ADDRESS "pool.ntp.org" // default
2989+
// if SNTP_SERVER_ADDRESS is defined, it always overrides user's config
2990+
// so we do not define it. sntp server can come from dhcp server, or by
2991+
// user.
2992+
//#define SNTP_SERVER_ADDRESS "pool.ntp.org" // default
29902993
#define SNTP_GET_SERVERS_FROM_DHCP 1
29912994
#define SNTP_SET_SYSTEM_TIME(t) (sntp_set_system_time(t)) // implemented in lwip2-sntp.c
29922995

0 commit comments

Comments
 (0)