diff --git a/src/Limelight.h b/src/Limelight.h index 0115697..8d72989 100644 --- a/src/Limelight.h +++ b/src/Limelight.h @@ -105,9 +105,9 @@ typedef struct _DECODE_UNIT { // Frame type int frameType; - // Receive time of first buffer - // NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and - // populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME + // Receive time of first buffer. This value uses an implementation-defined epoch. + // To compute actual latency values, use LiGetMillis() to get a timestamp that + // shares the same epoch as this value. unsigned long long receiveTimeMs; // Length of the entire buffer chain in bytes @@ -389,6 +389,11 @@ int LiSendMultiControllerEvent(short controllerNumber, short activeGamepadMask, // This function queues a vertical scroll event to the remote server. int LiSendScrollEvent(signed char scrollClicks); +// This function returns a time in milliseconds with an implementation-defined epoch. +// NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and +// populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME. +unsigned long long LiGetMillis(void); + #ifdef __cplusplus } #endif diff --git a/src/Misc.c b/src/Misc.c index 91c304f..c2da887 100644 --- a/src/Misc.c +++ b/src/Misc.c @@ -88,3 +88,7 @@ void LiInitializeConnectionCallbacks(PCONNECTION_LISTENER_CALLBACKS clCallbacks) void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo) { memset(serverInfo, 0, sizeof(*serverInfo)); } + +unsigned long long LiGetMillis(void) { + return PltGetMillis(); +} diff --git a/src/Platform.c b/src/Platform.c index 1cdaa1b..2c13817 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -293,7 +293,7 @@ int PltWaitForEvent(PLT_EVENT* event) { #endif } -uint64_t PltGetMillis(void) { +unsigned long long PltGetMillis(void) { #if defined(LC_WINDOWS) return GetTickCount64(); #elif HAVE_CLOCK_GETTIME diff --git a/src/Platform.h b/src/Platform.h index 1d2d823..41686bf 100644 --- a/src/Platform.h +++ b/src/Platform.h @@ -2,7 +2,6 @@ #include #include -#include #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -63,4 +62,4 @@ int initializePlatform(void); void cleanupPlatform(void); -uint64_t PltGetMillis(void); +unsigned long long PltGetMillis(void); diff --git a/src/RtpReorderQueue.h b/src/RtpReorderQueue.h index a24eee8..99ffac3 100644 --- a/src/RtpReorderQueue.h +++ b/src/RtpReorderQueue.h @@ -8,7 +8,7 @@ typedef struct _RTP_QUEUE_ENTRY { PRTP_PACKET packet; - uint64_t queueTimeMs; + unsigned long long queueTimeMs; struct _RTP_QUEUE_ENTRY* next; struct _RTP_QUEUE_ENTRY* prev;