summaryrefslogtreecommitdiff
path: root/components/libc/compilers/common/include/sys/time.h
diff options
context:
space:
mode:
authorMan, Jianting (Meco) <[email protected]>2022-11-22 21:40:50 -0500
committerGitHub <[email protected]>2022-11-22 21:40:50 -0500
commitbdd663a33fb0af8864344a7bf568a706669d96d4 (patch)
treebae6015a528c29a38a2630670aa382d07322b771 /components/libc/compilers/common/include/sys/time.h
parentfc83546cf5b7a412b9f191488cd50c90d22c93c6 (diff)
[libc][musl] support arm-linux-musleabi toolchain
目前基本功能已经可以在QEMU上跑起来,但是pthread和内核signal选中会报冲突。先合并一版本,后续解决这些问题。
Diffstat (limited to 'components/libc/compilers/common/include/sys/time.h')
-rw-r--r--components/libc/compilers/common/include/sys/time.h31
1 files changed, 15 insertions, 16 deletions
diff --git a/components/libc/compilers/common/include/sys/time.h b/components/libc/compilers/common/include/sys/time.h
index 346320bff0..e3bf3ee4ef 100644
--- a/components/libc/compilers/common/include/sys/time.h
+++ b/components/libc/compilers/common/include/sys/time.h
@@ -22,7 +22,7 @@ typedef __time64_t time_t;
#ifdef __cplusplus
extern "C" {
-#endif
+#endif /* __cplusplus */
#undef CLOCKS_PER_SEC
#define CLOCKS_PER_SEC RT_TICK_PER_SECOND
@@ -79,22 +79,21 @@ int stime(const time_t *t);
time_t timegm(struct tm * const t);
int gettimeofday(struct timeval *tv, struct timezone *tz);
int settimeofday(const struct timeval *tv, const struct timezone *tz);
-#if defined(__ARMCC_VERSION) || defined (__ICCARM__)
+
+#if defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32)
struct tm *gmtime_r(const time_t *timep, struct tm *r);
-struct tm* localtime_r(const time_t* t, struct tm* r);
char* asctime_r(const struct tm *t, char *buf);
char *ctime_r(const time_t * tim_p, char * result);
-#elif defined(_WIN32)
-struct tm* gmtime_r(const time_t* timep, struct tm* r);
-struct tm* gmtime(const time_t* t);
struct tm* localtime_r(const time_t* t, struct tm* r);
+#endif /* defined(__ARMCC_VERSION) || defined (__ICCARM__) || defined(_WIN32) */
+
+#ifdef _WIN32
+struct tm* gmtime(const time_t* t);
struct tm* localtime(const time_t* t);
time_t mktime(struct tm* const t);
-char* asctime_r(const struct tm* t, char* buf);
-char* ctime_r(const time_t* tim_p, char* result);
char* ctime(const time_t* tim_p);
time_t time(time_t* t);
-#endif
+#endif /* _WIN32 */
#ifdef RT_USING_POSIX_DELAY
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
@@ -112,20 +111,21 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
#ifndef CLOCK_REALTIME
#define CLOCK_REALTIME 1
-#endif
+#endif /* CLOCK_REALTIME */
#define CLOCK_CPUTIME_ID 2
#ifndef CLOCK_PROCESS_CPUTIME_ID
#define CLOCK_PROCESS_CPUTIME_ID CLOCK_CPUTIME_ID
-#endif
+#endif /* CLOCK_PROCESS_CPUTIME_ID */
+
#ifndef CLOCK_THREAD_CPUTIME_ID
#define CLOCK_THREAD_CPUTIME_ID CLOCK_CPUTIME_ID
-#endif
+#endif /* CLOCK_THREAD_CPUTIME_ID */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC 4
-#endif
+#endif /* CLOCK_MONOTONIC */
#endif /* defined(RT_USING_POSIX_CLOCK) || defined (RT_USING_POSIX_TIMER) */
#ifdef RT_USING_POSIX_CLOCK
@@ -142,8 +142,7 @@ int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid);
int timer_delete(timer_t timerid);
int timer_getoverrun(timer_t timerid);
int timer_gettime(timer_t timerid, struct itimerspec *its);
-int timer_settime(timer_t timerid, int flags, const struct itimerspec *value,
- struct itimerspec *ovalue);
+int timer_settime(timer_t timerid, int flags, const struct itimerspec *value, struct itimerspec *ovalue);
#endif /* RT_USING_POSIX_TIMER */
/* timezone */
@@ -153,6 +152,6 @@ int8_t tz_is_dst(void);
#ifdef __cplusplus
}
-#endif
+#endif /* __cplusplus */
#endif /* _SYS_TIME_H_ */