Skip to content

Commit 253f302

Browse files
committed
Fix some of the time functions
1 parent 58eccf4 commit 253f302

File tree

3 files changed

+4
-28
lines changed

3 files changed

+4
-28
lines changed

cores/esp8266/time.c

+2-26
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <time.h>
20+
#include <sys/reent.h>
2021
#include "sntp.h"
2122

2223

@@ -81,14 +82,6 @@ int clock_gettime(clockid_t unused, struct timespec *tp)
8182
return 0;
8283
}
8384

84-
// seconds since 1970
85-
time_t mktime(struct tm *t)
86-
{
87-
// system_mktime expects month in range 1..12
88-
#define START_MONTH 1
89-
return DIFF1900TO1970 + system_mktime(t->tm_year, t->tm_mon + START_MONTH, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
90-
}
91-
9285
time_t time(time_t * t)
9386
{
9487
time_t seconds = sntp_get_current_timestamp();
@@ -99,24 +92,7 @@ time_t time(time_t * t)
9992
return seconds;
10093
}
10194

102-
char* asctime(const struct tm *t)
103-
{
104-
return sntp_asctime(t);
105-
}
106-
107-
struct tm* localtime(const time_t *clock)
108-
{
109-
return sntp_localtime(clock);
110-
}
111-
112-
char* ctime(const time_t *t)
113-
{
114-
struct tm* p_tm = localtime(t);
115-
char* result = asctime(p_tm);
116-
return result;
117-
}
118-
119-
int gettimeofday(struct timeval *tp, void *tzp)
95+
int _gettimeofday_r(struct _reent* unused, struct timeval *tp, void *tzp)
12096
{
12197
if (tp)
12298
{

tools/sdk/lib/libcmin.a

-2.51 KB
Binary file not shown.

tools/sdk/lib/make_libcmin.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ lib_a-getopt.o
140140
lib_a-getreent.o
141141
lib_a-gets.o
142142
lib_a-getsubopt.o
143-
lib_a-gettimeofdayr.o
143+
# lib_a-gettimeofdayr.o
144144
lib_a-gettzinfo.o
145145
lib_a-getw.o
146146
lib_a-getwc.o
@@ -410,7 +410,7 @@ lib_a-syswrite.o
410410
lib_a-tdelete.o
411411
lib_a-tdestroy.o
412412
lib_a-tfind.o
413-
lib_a-time.o
413+
# lib_a-time.o
414414
lib_a-timelocal.o
415415
lib_a-timesr.o
416416
lib_a-tmpfile.o

0 commit comments

Comments
 (0)