summaryrefslogtreecommitdiff
path: root/components/libc/pthreads/pthread.c
diff options
context:
space:
mode:
authorMeco Man <[email protected]>2021-02-12 20:36:17 +0800
committerMeco Man <[email protected]>2021-02-12 20:36:17 +0800
commit598aa86f750bdc96ffb427fc8507a426a99fc63f (patch)
tree4f1e75f0587c23761a5d0dbae2956b636a13aae6 /components/libc/pthreads/pthread.c
parent40bb949cd552ea4f71b138712680f8e08246f9d8 (diff)
move clock_time_to_tick to time.c
Diffstat (limited to 'components/libc/pthreads/pthread.c')
-rw-r--r--components/libc/pthreads/pthread.c33
1 files changed, 0 insertions, 33 deletions
diff --git a/components/libc/pthreads/pthread.c b/components/libc/pthreads/pthread.c
index cec76a9691..7430510bf2 100644
--- a/components/libc/pthreads/pthread.c
+++ b/components/libc/pthreads/pthread.c
@@ -688,36 +688,3 @@ int pthread_cancel(pthread_t thread)
return 0;
}
RTM_EXPORT(pthread_cancel);
-
-int clock_time_to_tick(const struct timespec *time)
-{
- int tick;
- int nsecond, second;
- struct timespec tp;
-
- RT_ASSERT(time != RT_NULL);
-
- tick = RT_WAITING_FOREVER;
- if (time != NULL)
- {
- /* get current tp */
- clock_gettime(CLOCK_REALTIME, &tp);
-
- if ((time->tv_nsec - tp.tv_nsec) < 0)
- {
- nsecond = NANOSECOND_PER_SECOND - (tp.tv_nsec - time->tv_nsec);
- second = time->tv_sec - tp.tv_sec - 1;
- }
- else
- {
- nsecond = time->tv_nsec - tp.tv_nsec;
- second = time->tv_sec - tp.tv_sec;
- }
-
- tick = second * RT_TICK_PER_SECOND + nsecond * RT_TICK_PER_SECOND / NANOSECOND_PER_SECOND;
- if (tick < 0) tick = 0;
- }
-
- return tick;
-}
-RTM_EXPORT(clock_time_to_tick);