From b213da2d5fcc93cd24fc880c71c717d8e2ce2968 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sat, 30 Nov 2019 18:43:21 -0800
Subject: [PATCH] Fix build on 32bit arches with 64bit time_t

time element is deprecated on new input_event structure in kernel's
input.h [1]

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit?id=152194fe9c3f

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 utils/keytable/keytable.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c
index 6cb0217..59ff1ee 100644
--- a/utils/keytable/keytable.c
+++ b/utils/keytable/keytable.c
@@ -53,6 +53,11 @@
 
 # define N_(string) string
 
+#ifndef input_event_sec
+#define input_event_sec time.tv_sec
+#define input_event_usec time.tv_usec
+#endif
+
 struct input_keymap_entry_v2 {
 #define KEYMAP_BY_INDEX	(1 << 0)
 	u_int8_t  flags;
@@ -1533,7 +1538,7 @@ static void test_event(struct rc_device *rc_dev, int fd)
 
 		for (i = 0; i < rd / sizeof(struct input_event); i++) {
 			printf(_("%ld.%06ld: event type %s(0x%02x)"),
-				ev[i].time.tv_sec, ev[i].time.tv_usec,
+				ev[i].input_event_sec, ev[i].input_event_usec,
 				get_event_name(events_type, ev[i].type), ev[i].type);
 
 			switch (ev[i].type) {
