Lines Matching refs:ts
95 static inline void timespec_add_ms(timespec& ts, size_t ms) { in timespec_add_ms() argument
96 ts.tv_sec += ms / 1000; in timespec_add_ms()
97 ts.tv_nsec += (ms % 1000) * 1000000; in timespec_add_ms()
98 if (ts.tv_nsec >= NS_PER_S) { in timespec_add_ms()
99 ts.tv_sec++; in timespec_add_ms()
100 ts.tv_nsec -= NS_PER_S; in timespec_add_ms()
108 timespec ts; in TEST() local
109 ASSERT_EQ(0, clock_gettime(CLOCK_REALTIME, &ts)); in TEST()
110 timespec_add_ms(ts, 100); in TEST()
113 ASSERT_EQ(-1, sem_timedwait(&s, &ts)); in TEST()
118 ts.tv_nsec = -1; in TEST()
119 ASSERT_EQ(-1, sem_timedwait(&s, &ts)); in TEST()
122 ts.tv_nsec = NS_PER_S; in TEST()
123 ASSERT_EQ(-1, sem_timedwait(&s, &ts)); in TEST()
127 ts.tv_nsec = NS_PER_S - 1; in TEST()
128 ts.tv_sec = -1; in TEST()
129 ASSERT_EQ(-1, sem_timedwait(&s, &ts)); in TEST()