diff --git a/libsuinput/src/suinput.c b/libsuinput/src/suinput.c index 8d5fb71..8c368e6 100644 --- a/libsuinput/src/suinput.c +++ b/libsuinput/src/suinput.c @@ -28,6 +28,14 @@ #include "suinput.h" +#ifndef input_event_sec +#define input_event_sec time.tv_sec +#endif + +#ifndef input_event_usec +#define input_event_usec time.tv_usec +#endif + int suinput_write_event(int uinput_fd, const struct input_event *event_p) { ssize_t bytes; @@ -43,9 +51,12 @@ int suinput_emit(int uinput_fd, uint16_t ev_type, uint16_t ev_code, int32_t ev_value) { struct input_event event; + struct timeval tv; memset(&event, 0, sizeof(event)); - gettimeofday(&event.time, 0); + gettimeofday(&tv, 0); + event.input_event_sec = tv.tv_sec; + event.input_event_usec = tv.tv_usec; event.type = ev_type; event.code = ev_code; event.value = ev_value;