mirror of https://github.com/yshui/picom.git
Fix lack of timespec_get() on Android.
Some versions of the Android libc do not have timespec_get(), use clock_gettime() instead on Android. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
ad18d129cc
commit
062f50af39
15
src/utils.h
15
src/utils.h
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <test.h>
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "compiler.h"
|
||||
#include "types.h"
|
||||
|
||||
|
@ -277,5 +279,18 @@ allocchk_(const char *func_name, const char *file, unsigned int line, void *ptr)
|
|||
///
|
||||
int next_power_of_two(int n);
|
||||
|
||||
// Some versions of the Android libc do not have timespec_get(), use
|
||||
// clock_gettime() instead.
|
||||
#ifdef __ANDROID__
|
||||
|
||||
#ifndef TIME_UTC
|
||||
#define TIME_UTC 1
|
||||
#endif
|
||||
|
||||
static inline int timespec_get(struct timespec *ts, int base) {
|
||||
assert(base == TIME_UTC);
|
||||
return clock_gettime(CLOCK_REALTIME, ts);
|
||||
}
|
||||
#endif
|
||||
|
||||
// vim: set noet sw=8 ts=8 :
|
||||
|
|
Loading…
Reference in New Issue