From be13de0679d1707eadaf5349ab904a07fa83bb13 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Wed, 7 Oct 2020 17:34:56 +0100 Subject: [PATCH] Remove p8 os includes Signed-off-by: Bernd Kuhls --- src/Socket.cpp | 1 - src/lib/tsreader/FileReader.h | 1 - src/lib/tsreader/MemorySink.cpp | 1 - src/lib/tsreader/Section.cpp | 2 ++ src/os-dependent.h | 40 ++++++++++++++++++--------------- src/timers.cpp | 1 - src/windows/FileUtils.cpp | 6 ++++- 7 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/Socket.cpp b/src/Socket.cpp index 12f7e80..b7dd250 100644 --- a/src/Socket.cpp +++ b/src/Socket.cpp @@ -7,7 +7,6 @@ #include "utils.h" #include -#include "p8-platform/os.h" #include "Socket.h" #include diff --git a/src/lib/tsreader/FileReader.h b/src/lib/tsreader/FileReader.h index 986bbc4..edb01f2 100644 --- a/src/lib/tsreader/FileReader.h +++ b/src/lib/tsreader/FileReader.h @@ -33,7 +33,6 @@ * http://forums.dvbowners.com/ */ -#include "p8-platform/os.h" // for __stat #include #include diff --git a/src/lib/tsreader/MemorySink.cpp b/src/lib/tsreader/MemorySink.cpp index 2d60696..dafef56 100644 --- a/src/lib/tsreader/MemorySink.cpp +++ b/src/lib/tsreader/MemorySink.cpp @@ -29,7 +29,6 @@ #if defined LIVE555 -#include "p8-platform/os.h" #include "MemorySink.h" #include "GroupsockHelper.hh" #include //for kodi::Log diff --git a/src/lib/tsreader/Section.cpp b/src/lib/tsreader/Section.cpp index 258c6a9..aac6b53 100644 --- a/src/lib/tsreader/Section.cpp +++ b/src/lib/tsreader/Section.cpp @@ -22,6 +22,8 @@ #include "os-dependent.h" #include "Section.h" +#include + namespace MPTV { CSection::CSection(void) diff --git a/src/os-dependent.h b/src/os-dependent.h index 1f368ea..cdc6980 100644 --- a/src/os-dependent.h +++ b/src/os-dependent.h @@ -7,29 +7,33 @@ #pragma once -#include "p8-platform/os.h" +#include -#ifdef TARGET_LINUX -// Retrieve the number of milliseconds that have elapsed since the system was started -#include -inline unsigned long long GetTickCount64(void) -{ - struct timespec ts; - if(clock_gettime(CLOCK_MONOTONIC, &ts) != 0) - { - return 0; - } - return (unsigned long long)( (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000) ); -}; -#elif defined(TARGET_DARWIN) -#include +#if (defined(_WIN32) || defined(_WIN64)) + +#ifndef _SSIZE_T_DEFINED +#ifdef _WIN64 +typedef __int64 ssize_t; +#else +typedef _W64 int ssize_t; +#endif +#define _SSIZE_T_DEFINED +#endif + +#else + +#if (defined(TARGET_LINUX) || defined(TARGET_DARWIN)) +#include +#include +#include inline unsigned long long GetTickCount64(void) { - struct timeval tv; - gettimeofday(&tv, NULL); - return (unsigned long long)( (tv.tv_sec * 1000) + (tv.tv_usec / 1000) ); + auto now = std::chrono::steady_clock::now(); + return std::chrono::duration_cast(now.time_since_epoch()).count(); }; #endif /* TARGET_LINUX || TARGET_DARWIN */ +#endif + // Additional typedefs typedef uint8_t byte; diff --git a/src/timers.cpp b/src/timers.cpp index a8760e4..a60b4c2 100644 --- a/src/timers.cpp +++ b/src/timers.cpp @@ -11,7 +11,6 @@ using namespace std; -#include "p8-platform/os.h" //needed for snprintf #include "timers.h" #include "settings.h" #include "utils.h" diff --git a/src/windows/FileUtils.cpp b/src/windows/FileUtils.cpp index 0d26bc6..0c8a03e 100644 --- a/src/windows/FileUtils.cpp +++ b/src/windows/FileUtils.cpp @@ -6,7 +6,6 @@ */ #include "../FileUtils.h" -#include "p8-platform/os.h" #include "p8-platform/windows/CharsetConverter.h" #include #include "../utils.h" @@ -14,6 +13,11 @@ #include #endif +#ifdef TARGET_WINDOWS +#include +#include +#endif + namespace OS { bool CFile::Exists(const std::string& strFileName, long* errCode)