add pa_timespec_load

This commit is contained in:
Lennart Poettering 2009-02-19 04:00:29 +01:00
parent 45218aa226
commit 9cbdd3a968
2 changed files with 10 additions and 0 deletions

View file

@ -141,3 +141,11 @@ struct timeval* pa_rtclock_from_wallclock(struct timeval *tv) {
return tv; return tv;
} }
pa_usec_t pa_timespec_load(const struct timespec *ts) {
pa_assert(ts);
return
(pa_usec_t) ts->tv_sec * PA_USEC_PER_SEC +
(pa_usec_t) ts->tv_nsec / PA_NSEC_PER_USEC;
}

View file

@ -42,4 +42,6 @@ void pa_rtclock_hrtimer_enable(void);
struct timeval* pa_rtclock_from_wallclock(struct timeval *tv); struct timeval* pa_rtclock_from_wallclock(struct timeval *tv);
pa_usec_t pa_timespec_load(const struct timespec *ts);
#endif #endif