mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2026-04-09 17:26:08 +00:00
Add LiGetMillis() for clients to use for latency calculation
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user