Merge "Make it harder to use a broken legacy function by accident."
This commit is contained in:
commit
5b528c0832
|
@ -51,13 +51,3 @@ void timeval_from_timespec(timeval& tv, const timespec& ts) {
|
|||
tv.tv_sec = ts.tv_sec;
|
||||
tv.tv_usec = ts.tv_nsec / 1000;
|
||||
}
|
||||
|
||||
void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts, clockid_t clock) {
|
||||
clock_gettime(clock, &abs_ts);
|
||||
abs_ts.tv_sec += ts.tv_sec;
|
||||
abs_ts.tv_nsec += ts.tv_nsec;
|
||||
if (abs_ts.tv_nsec >= NS_PER_S) {
|
||||
abs_ts.tv_nsec -= NS_PER_S;
|
||||
abs_ts.tv_sec++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,6 @@ __LIBC_HIDDEN__ void timespec_from_ms(timespec& ts, const int ms);
|
|||
|
||||
__LIBC_HIDDEN__ void timeval_from_timespec(timeval& tv, const timespec& ts);
|
||||
|
||||
__LIBC_HIDDEN__ void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts,
|
||||
clockid_t clock);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
static inline int check_timespec(const timespec* ts, bool null_allowed) {
|
||||
|
@ -62,4 +59,16 @@ static inline int check_timespec(const timespec* ts, bool null_allowed) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !defined(__LP64__)
|
||||
static inline void absolute_timespec_from_timespec(timespec& abs_ts, const timespec& ts, clockid_t clock) {
|
||||
clock_gettime(clock, &abs_ts);
|
||||
abs_ts.tv_sec += ts.tv_sec;
|
||||
abs_ts.tv_nsec += ts.tv_nsec;
|
||||
if (abs_ts.tv_nsec >= NS_PER_S) {
|
||||
abs_ts.tv_nsec -= NS_PER_S;
|
||||
abs_ts.tv_sec++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue