mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-06-17 14:21:30 +00:00
Add LiGetMillis() for clients to use for latency calculation
This commit is contained in:
+8
-3
@@ -105,9 +105,9 @@ typedef struct _DECODE_UNIT {
|
|||||||
// Frame type
|
// Frame type
|
||||||
int frameType;
|
int frameType;
|
||||||
|
|
||||||
// Receive time of first buffer
|
// Receive time of first buffer. This value uses an implementation-defined epoch.
|
||||||
// NOTE: This will be populated from gettimeofday() if !HAVE_CLOCK_GETTIME and
|
// To compute actual latency values, use LiGetMillis() to get a timestamp that
|
||||||
// populated from clock_gettime(CLOCK_MONOTONIC) if HAVE_CLOCK_GETTIME
|
// shares the same epoch as this value.
|
||||||
unsigned long long receiveTimeMs;
|
unsigned long long receiveTimeMs;
|
||||||
|
|
||||||
// Length of the entire buffer chain in bytes
|
// 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.
|
// This function queues a vertical scroll event to the remote server.
|
||||||
int LiSendScrollEvent(signed char scrollClicks);
|
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
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -88,3 +88,7 @@ void LiInitializeConnectionCallbacks(PCONNECTION_LISTENER_CALLBACKS clCallbacks)
|
|||||||
void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo) {
|
void LiInitializeServerInformation(PSERVER_INFORMATION serverInfo) {
|
||||||
memset(serverInfo, 0, sizeof(*serverInfo));
|
memset(serverInfo, 0, sizeof(*serverInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long long LiGetMillis(void) {
|
||||||
|
return PltGetMillis();
|
||||||
|
}
|
||||||
|
|||||||
+1
-1
@@ -293,7 +293,7 @@ int PltWaitForEvent(PLT_EVENT* event) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t PltGetMillis(void) {
|
unsigned long long PltGetMillis(void) {
|
||||||
#if defined(LC_WINDOWS)
|
#if defined(LC_WINDOWS)
|
||||||
return GetTickCount64();
|
return GetTickCount64();
|
||||||
#elif HAVE_CLOCK_GETTIME
|
#elif HAVE_CLOCK_GETTIME
|
||||||
|
|||||||
+1
-2
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@@ -63,4 +62,4 @@
|
|||||||
int initializePlatform(void);
|
int initializePlatform(void);
|
||||||
void cleanupPlatform(void);
|
void cleanupPlatform(void);
|
||||||
|
|
||||||
uint64_t PltGetMillis(void);
|
unsigned long long PltGetMillis(void);
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
typedef struct _RTP_QUEUE_ENTRY {
|
typedef struct _RTP_QUEUE_ENTRY {
|
||||||
PRTP_PACKET packet;
|
PRTP_PACKET packet;
|
||||||
|
|
||||||
uint64_t queueTimeMs;
|
unsigned long long queueTimeMs;
|
||||||
|
|
||||||
struct _RTP_QUEUE_ENTRY* next;
|
struct _RTP_QUEUE_ENTRY* next;
|
||||||
struct _RTP_QUEUE_ENTRY* prev;
|
struct _RTP_QUEUE_ENTRY* prev;
|
||||||
|
|||||||
Reference in New Issue
Block a user