Home
last modified time | relevance | path

Searched refs:ts (Results 1 – 25 of 32) sorted by relevance

12

/bionic/libc/private/
Dbionic_time_conversions.h40 __LIBC_HIDDEN__ bool timespec_from_timeval(timespec& ts, const timeval& tv);
41 __LIBC_HIDDEN__ void timespec_from_ms(timespec& ts, const int ms);
43 __LIBC_HIDDEN__ void timeval_from_timespec(timeval& tv, const timespec& ts);
53 static inline int check_timespec(const timespec* ts, bool null_allowed) { in check_timespec() argument
54 if (null_allowed && ts == nullptr) { in check_timespec()
59 if (ts->tv_nsec < 0 || ts->tv_nsec >= NS_PER_S) { in check_timespec()
62 if (ts->tv_sec < 0) { in check_timespec()
69 static inline void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts, clockid_t … in absolute_timespec_from_timespec() argument
71 abs_ts.tv_sec += ts.tv_sec; in absolute_timespec_from_timespec()
72 abs_ts.tv_nsec += ts.tv_nsec; in absolute_timespec_from_timespec()
/bionic/libc/bionic/
Dpoll.cpp42 timespec ts; in poll() local
45 timespec_from_ms(ts, ms); in poll()
46 ts_ptr = &ts; in poll()
51 int ppoll(pollfd* fds, nfds_t fd_count, const timespec* ts, const sigset_t* ss) { in ppoll() argument
54 return ppoll64(fds, fd_count, ts, set.ptr); in ppoll()
57 int ppoll64(pollfd* fds, nfds_t fd_count, const timespec* ts, const sigset64_t* ss) { in ppoll64() argument
61 if (ts != nullptr) { in ppoll64()
62 mutable_ts = *ts; in ppoll64()
77 timespec ts; in select() local
80 if (!timespec_from_timeval(ts, *tv)) { in select()
[all …]
Dsys_time.cpp38 timespec ts[2]; in futimesat() local
39 if (tv && (!timespec_from_timeval(ts[0], tv[0]) || !timespec_from_timeval(ts[1], tv[1]))) { in futimesat()
43 return utimensat(fd, path, tv ? ts : nullptr, flags); in futimesat()
59 timespec ts[2]; in futimes() local
60 if (tv && (!timespec_from_timeval(ts[0], tv[0]) || !timespec_from_timeval(ts[1], tv[1]))) { in futimes()
64 return futimens(fd, tv ? ts : nullptr); in futimes()
Dbionic_time_conversions.cpp33 bool timespec_from_timeval(timespec& ts, const timeval& tv) { in timespec_from_timeval() argument
35 ts.tv_sec = tv.tv_sec; in timespec_from_timeval()
41 ts.tv_nsec = tv.tv_usec * 1000; in timespec_from_timeval()
45 void timespec_from_ms(timespec& ts, const int ms) { in timespec_from_ms() argument
46 ts.tv_sec = ms / 1000; in timespec_from_ms()
47 ts.tv_nsec = (ms % 1000) * 1000000; in timespec_from_ms()
50 void timeval_from_timespec(timeval& tv, const timespec& ts) { in timeval_from_timespec() argument
51 tv.tv_sec = ts.tv_sec; in timeval_from_timespec()
52 tv.tv_usec = ts.tv_nsec / 1000; in timeval_from_timespec()
Dusleep.cpp34 timespec ts; in usleep() local
35 ts.tv_sec = us / 1000000; in usleep()
36 ts.tv_nsec = (us % 1000000) * 1000; in usleep()
37 return nanosleep(&ts, nullptr); in usleep()
Dclock.cpp37 timespec ts; in clock() local
38 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts); in clock()
39 return (ts.tv_sec * CLOCKS_PER_SEC) + (ts.tv_nsec / (NS_PER_S / CLOCKS_PER_SEC)); in clock()
Dtime.cpp31 int timespec_get(timespec* ts, int base) { in timespec_get() argument
32 return (clock_gettime(base - 1, ts) != -1) ? base : 0; in timespec_get()
35 int timespec_getres(timespec* ts, int base) { in timespec_getres() argument
36 return (clock_getres(base - 1, ts) != -1) ? base : 0; in timespec_getres()
Dsleep.cpp39 timespec ts = {.tv_sec = static_cast<time_t>(s)}; in sleep() local
40 return (nanosleep(&ts, &ts) == -1) ? ts.tv_sec : 0; in sleep()
Dsys_sem.cpp63 int semtimedop(int id, sembuf* ops, size_t op_count, const timespec* ts) { in semtimedop() argument
65 return syscall(SYS_semtimedop, id, ops, op_count, ts); in semtimedop()
67 return syscall(SYS_ipc, SEMTIMEDOP, id, op_count, 0, ops, ts); in semtimedop()
Dpthread_cond.cpp267 timespec ts; in pthread_cond_timedwait_relative_np() local
270 absolute_timespec_from_timespec(ts, *rel_timeout, CLOCK_MONOTONIC); in pthread_cond_timedwait_relative_np()
271 abs_timeout = &ts; in pthread_cond_timedwait_relative_np()
282 timespec ts; in pthread_cond_timeout_np() local
283 timespec_from_ms(ts, ms); in pthread_cond_timeout_np()
284 return pthread_cond_timedwait_relative_np(cond_interface, mutex, &ts); in pthread_cond_timeout_np()
Dposix_timers.cpp224 int timer_gettime(timer_t id, itimerspec* ts) { in timer_gettime() argument
225 return __timer_gettime(to_kernel_timer_id(id), ts); in timer_gettime()
233 int timer_settime(timer_t id, int flags, const itimerspec* ts, itimerspec* ots) { in timer_settime() argument
235 return __timer_settime(timer->kernel_timer_id, flags, ts, ots); in timer_settime()
Dndk_cruft.cpp108 char* strtotimeval(const char* str, struct timeval* ts) { in strtotimeval() argument
110 ts->tv_sec = strtoumax(str, &s, 10); in strtotimeval()
130 ts->tv_usec = fractional_seconds; in strtotimeval()
/bionic/tests/
Dsemaphore_test.cpp101 static inline void timespec_add_ms(timespec& ts, size_t ms) { in timespec_add_ms() argument
102 ts.tv_sec += ms / 1000; in timespec_add_ms()
103 ts.tv_nsec += (ms % 1000) * 1000000; in timespec_add_ms()
104 if (ts.tv_nsec >= NS_PER_S) { in timespec_add_ms()
105 ts.tv_sec++; in timespec_add_ms()
106 ts.tv_nsec -= NS_PER_S; in timespec_add_ms()
115 timespec ts; in sem_timedwait_helper() local
116 ASSERT_EQ(0, clock_gettime(clock, &ts)); in sem_timedwait_helper()
117 timespec_add_ms(ts, 100); in sem_timedwait_helper()
120 ASSERT_EQ(-1, wait_function(&s, &ts)); in sem_timedwait_helper()
[all …]
Dtime_test.cpp628 itimerspec ts; in SetTime() local
629 ts.it_value.tv_sec = value_s; in SetTime()
630 ts.it_value.tv_nsec = value_ns; in SetTime()
631 ts.it_interval.tv_sec = interval_s; in SetTime()
632 ts.it_interval.tv_nsec = interval_ns; in SetTime()
633 ASSERT_EQ(0, timer_settime(t, 0, &ts, nullptr)); in SetTime()
682 itimerspec ts; in TEST() local
683 ts.it_value.tv_sec = 0; in TEST()
684 ts.it_value.tv_nsec = 1; in TEST()
685 ts.it_interval.tv_sec = 0; in TEST()
[all …]
Dpoll_test.cpp46 timespec ts = { .tv_nsec = 100 }; in TEST() local
47 ASSERT_EQ(0, ppoll(nullptr, 0, &ts, nullptr)); in TEST()
55 timespec ts = { .tv_nsec = 100 }; in TEST() local
56 ASSERT_EQ(0, ppoll64(nullptr, 0, &ts, nullptr)); in TEST()
Dpthread_test.cpp615 timespec ts; in TEST() local
616 ASSERT_EQ(0, clock_gettime(c, &ts)); in TEST()
1002 timespec ts; in TEST() local
1003 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
1004 ts.tv_sec += 1; in TEST()
1006 return pthread_rwlock_timedwrlock(lock, &ts); in TEST()
1012 timespec ts; in TEST() local
1013 ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts)); in TEST()
1014 ts.tv_sec += 1; in TEST()
1016 [&](pthread_rwlock_t* lock) { return pthread_rwlock_timedwrlock_monotonic_np(lock, &ts); }); in TEST()
[all …]
Dsys_epoll_test.cpp65 timespec ts = {.tv_nsec = 500}; in TEST() local
66 int rc = epoll_pwait2(epoll_fd, events, 1, &ts, nullptr); in TEST()
92 timespec ts = {.tv_nsec = 500}; in TEST() local
96 int rc = epoll_pwait2(epoll_fd, events, 1, &ts, &ss2); in TEST()
110 timespec ts = {.tv_nsec = 500}; in TEST() local
114 int rc = epoll_pwait2_64(epoll_fd, events, 1, &ts, &ss2); in TEST()
Dthreads_test.cpp188 timespec ts = {}; in TEST()
189 ASSERT_EQ(thrd_timedout, cnd_timedwait(&c, &m, &ts)); in TEST()
208 timespec ts; in TEST()
209 ASSERT_EQ(TIME_UTC, timespec_get(&ts, TIME_UTC)); in TEST()
210 ts.tv_sec += 666; in TEST()
212 ASSERT_EQ(thrd_success, cnd_timedwait(&c, &m, &ts)); in TEST()
285 timespec ts = {}; in TEST()
286 ASSERT_EQ(thrd_success, mtx_timedlock(&m, &ts)); in TEST()
289 timespec ts = { .tv_nsec = 500000 }; in TEST()
290 ASSERT_EQ(thrd_timedout, mtx_timedlock(&m, &ts)); in TEST()
Dsys_socket_test.cpp158 struct timespec ts; in TestRecvMMsg() local
159 memset(&ts, 0, sizeof(ts)); in TestRecvMMsg()
160 ts.tv_sec = 5; in TestRecvMMsg()
161 ts.tv_nsec = 0; in TestRecvMMsg()
163 static_cast<size_t>(recvmmsg(fd_acc, msgs, NUM_RECV_MSGS, 0, &ts))) in TestRecvMMsg()
Dsys_sem_test.cpp63 timespec ts = { .tv_sec = 0, .tv_nsec = 100 }; in TEST() local
66 ASSERT_EQ(-1, semtimedop(id, ops, 1, &ts)); in TEST()
/bionic/libc/include/sys/
Dtime.h102 #define TIMEVAL_TO_TIMESPEC(tv, ts) { \ argument
103 (ts)->tv_sec = (tv)->tv_sec; \
104 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
106 #define TIMESPEC_TO_TIMEVAL(tv, ts) { \ argument
107 (tv)->tv_sec = (ts)->tv_sec; \
108 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
/bionic/libc/upstream-openbsd/lib/libc/net/
Dres_random.c178 struct timespec ts; in res_initid() local
222 clock_gettime(CLOCK_MONOTONIC, &ts); in res_initid()
223 ru_reseed = ts.tv_sec + RU_OUT; in res_initid()
230 struct timespec ts; in __res_randomid() local
235 clock_gettime(CLOCK_MONOTONIC, &ts); in __res_randomid()
240 if (ru_counter >= RU_MAX || ts.tv_sec > ru_reseed || pid != ru_pid) { in __res_randomid()
/bionic/libc/kernel/uapi/linux/
Derrqueue.h42 struct timespec ts[3]; member
45 struct __kernel_timespec ts[3]; member
Dptp_clock.h64 struct ptp_clock_time ts[2 * PTP_MAX_SAMPLES + 1]; member
69 struct ptp_clock_time ts[PTP_MAX_SAMPLES][3]; member
/bionic/libc/upstream-netbsd/lib/libc/isc/
Dev_timers.c168 struct timespec ts; in evTimeSpec() local
170 ts.tv_sec = tv.tv_sec; in evTimeSpec()
171 ts.tv_nsec = tv.tv_usec * 1000; in evTimeSpec()
172 return (ts); in evTimeSpec()
176 evTimeVal(struct timespec ts) { in evTimeVal() argument
179 tv.tv_sec = ts.tv_sec; in evTimeVal()
180 tv.tv_usec = (suseconds_t)(ts.tv_nsec / 1000); in evTimeVal()

12