summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-02-12 01:46:16 +0800
committerMeco Man <[email protected]>2021-02-12 01:46:16 +0800
commit417f8b9bed25d12a4b61150138125e8bd9c38fc4 (patch)
tree516ca1e547534683707cd9016931e1cfe60f4dda
parent107c27f38d1a8683db5a2af55fb6a4bc54533005 (diff)
update
-rw-r--r--components/libc/compilers/common/time.c16
-rw-r--r--components/libc/compilers/newlib/libc_syms.c4
2 files changed, 16 insertions, 4 deletions
diff --git a/components/libc/compilers/common/time.c b/components/libc/compilers/common/time.c
index 8aaf8893dc..d7048acc4a 100644
--- a/components/libc/compilers/common/time.c
+++ b/components/libc/compilers/common/time.c
@@ -100,12 +100,14 @@ struct tm *gmtime_r(const time_t *timep, struct tm *r)
r->tm_isdst = 0;
return r;
}
+RTM_EXPORT(gmtime_r);
struct tm* gmtime(const time_t* t)
{
static struct tm tmp;
return gmtime_r(t, &tmp);
}
+RTM_EXPORT(gmtime);
/*TODO: timezone */
struct tm* localtime_r(const time_t* t, struct tm* r)
@@ -117,18 +119,21 @@ struct tm* localtime_r(const time_t* t, struct tm* r)
local_tz = *t + utc_plus * 3600;
return gmtime_r(&local_tz, r);
}
+RTM_EXPORT(localtime_r);
struct tm* localtime(const time_t* t)
{
static struct tm tmp;
return localtime_r(t, &tmp);
}
+RTM_EXPORT(localtime);
/* TODO: timezone */
time_t mktime(struct tm * const t)
{
return timegm(t);
}
+RTM_EXPORT(mktime);
char* asctime_r(const struct tm *t, char *buf)
{
@@ -150,28 +155,33 @@ char* asctime_r(const struct tm *t, char *buf)
buf[24] = '\n';
return buf;
}
+RTM_EXPORT(asctime_r);
char* asctime(const struct tm *timeptr)
{
static char buf[25];
return asctime_r(timeptr, buf);
}
+RTM_EXPORT(asctime);
char *ctime_r (const time_t * tim_p, char * result)
{
struct tm tm;
return asctime_r (localtime_r (tim_p, &tm), result);
}
+RTM_EXPORT(ctime_r);
char* ctime(const time_t *tim_p)
{
return asctime (localtime (tim_p));
}
+RTM_EXPORT(ctime);
double difftime (time_t tim1, time_t tim2)
{
return (double)(tim1 - tim2);
}
+RTM_EXPORT(difftime);
/**
* Returns the current time.
@@ -219,11 +229,13 @@ RT_WEAK time_t time(time_t *t)
return time_now;
}
+RTM_EXPORT(time);
RT_WEAK clock_t clock(void)
{
return rt_tick_get();
}
+RTM_EXPORT(clock);
int stime(const time_t *t)
{
@@ -249,6 +261,7 @@ int stime(const time_t *t)
return -1;
#endif /* RT_USING_RTC */
}
+RTM_EXPORT(stime);
time_t timegm(struct tm * const t)
{
@@ -323,6 +336,7 @@ time_t timegm(struct tm * const t)
i = 60;
return ((day + t->tm_hour) * i + t->tm_min) * i + t->tm_sec;
}
+RTM_EXPORT(timegm);
/* TODO: timezone */
int gettimeofday(struct timeval *tv, struct timezone *tz)
@@ -341,6 +355,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
return -1;
}
}
+RTM_EXPORT(gettimeofday);
/* TODO: timezone */
int settimeofday(const struct timeval *tv, const struct timezone *tz)
@@ -355,6 +370,7 @@ int settimeofday(const struct timeval *tv, const struct timezone *tz)
return -1;
}
}
+RTM_EXPORT(settimeofday);
#ifdef RT_USING_PTHREADS
static struct timeval _timevalue;
diff --git a/components/libc/compilers/newlib/libc_syms.c b/components/libc/compilers/newlib/libc_syms.c
index b150c10fd6..4b0ee355f0 100644
--- a/components/libc/compilers/newlib/libc_syms.c
+++ b/components/libc/compilers/newlib/libc_syms.c
@@ -39,10 +39,6 @@ RTM_EXPORT(snprintf);
RTM_EXPORT(fwrite);
-#include <time.h>
-RTM_EXPORT(localtime);
-RTM_EXPORT(time);
-
#include <setjmp.h>
RTM_EXPORT(longjmp);
RTM_EXPORT(setjmp);