Natanael Copa d87c1d511d community/libevdevplus: fix build with time64
note that this breaks API
2020-08-07 19:21:58 +00:00

36 lines
811 B
Diff

diff --git a/InputEvent.hpp b/InputEvent.hpp
index 04ead03..16647b2 100644
--- a/InputEvent.hpp
+++ b/InputEvent.hpp
@@ -15,12 +15,16 @@
#include "CommonIncludes.hpp"
+#ifndef input_event_sec
+#define input_event_sec time.tv_sec
+#define input_event_usec time.tv_usec
+#endif
+
namespace evdevPlus {
class InputEvent {
public:
input_event event{};
- timeval &Time = event.time;
uint16_t &Type = event.type;
uint16_t &Code = event.code;
int32_t &Value = event.value;
@@ -36,8 +40,10 @@ namespace evdevPlus {
Code = code;
Value = value;
- if (time)
- memcpy(&event.time, time, sizeof(timeval));
+ if (time) {
+ event.input_event_sec = time->tv_sec;
+ event.input_event_usec = time->tv_usec;
+ }
}
friend void swap(InputEvent &first, InputEvent &second) {