controlapi.cpp: try to fix build errors if member 'time' is not found

Ensure backward compatibility for rc_sync and channelEPGformated

- Added conditional compilation in rc_sync to check for input_event_sec macro.
- Used input_event_sec and input_event_usec macros if defined.
- Provided fallback to direct timeval members for older versions.
- Minor formatting adjustment in channelEPGformated for consistency.

This should ensure compatibility with both newer and older
kernel versions, different C library implementations,
and possible standard settings of build systems.
Addressing different definitions of the input_event structure maintains
robustness across kernel, library, and build system configurations.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 1945b2f089
Author: Thilo Graf <dbt@novatux.de>
Date: 2024-09-02 (Mon, 02 Sep 2024)



------------------
This commit was generated by Migit
This commit is contained in:
2024-09-02 21:06:01 +02:00
committed by vanhofen
parent e5ab98d5fc
commit 157306a8da

View File

@@ -1002,7 +1002,18 @@ void CControlAPI::rc_sync(int fd)
{
struct input_event ev;
gettimeofday(&ev.time, NULL);
// Check if input_event_sec macro is defined
#ifdef input_event_sec
// Use input_event_sec and input_event_usec macros if they are defined
struct timeval tv;
gettimeofday(&tv, NULL);
ev.input_event_sec = tv.tv_sec;
ev.input_event_usec = tv.tv_usec;
#else
// Fallback for older versions that use timeval directly
gettimeofday(&ev.time, NULL);
#endif
ev.type = EV_SYN;
ev.code = SYN_REPORT;
ev.value = 0;
@@ -1804,6 +1815,7 @@ std::string CControlAPI::channelEPGformated(CyhookHandler *hh, int bouquetnr, t_
return result;
}
//-----------------------------------------------------------------------------
// Detailed EPG list in XML or JSON
//-----------------------------------------------------------------------------