summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2023-09-26 18:40:01 +0800
committeryangwei <[email protected]>2023-09-26 18:40:01 +0800
commitde09ab88e45a8fef1a9662c89ac880ea13c42895 (patch)
tree3dd3275438711e8e2b0ad33c40df9aa8ae51ceac
parentb89b6a58f59000e9abe99f1e41f6d76a8b4dc4bf (diff)
🐞 fix(sapp timestamp ms): 使用CLOCK_REALTIME替代CLOCK_MONOTONIC获取ms时间戳v4.3.27
-rw-r--r--src/timer/sapp_timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/timer/sapp_timer.c b/src/timer/sapp_timer.c
index 7c5f07d..6d70f33 100644
--- a/src/timer/sapp_timer.c
+++ b/src/timer/sapp_timer.c
@@ -2,6 +2,7 @@
#include "sapp_private_api.h"
#include "public/sapp_timer.h"
#include "sapp_declaration.h"
+#include <bits/time.h>
#ifdef LIBEVENT_ENABLED
#include "support/event2/event.h"
@@ -403,7 +404,7 @@ static inline long long sapp_get_current_time_in_ms(void)
//gettimeofday(&t, NULL);
//tms = t.tv_sec * 1000 + t.tv_usec/1000;
struct timespec t;
- clock_gettime(CLOCK_MONOTONIC, &t);
+ clock_gettime(CLOCK_REALTIME, &t);
tms = (t.tv_sec)*1000 + (t.tv_nsec)/(1000*1000);
return tms;