player: store last_time timestamp in nanoseconds
This commit is contained in:
1 parent
ae335ef155
commit
8fccd6bf91
2 files changed
+3
-3
No files matched your search
+1
-1
@@ -391,7 +391,7 @@ typedef struct MPContext {
|
||||
double start_timestamp;
|
||||
|
||||
// Timestamp from the last time some timing functions read the
|
||||
// current time, in microseconds.
|
||||
// current time, in nanoseconds.
|
||||
// Used to turn a new time value to a delta from last time.
|
||||
int64_t last_time;
|
||||
|
||||
|
||||
+2
-2
@@ -123,10 +123,10 @@ static void mp_process_input(struct MPContext *mpctx)
|
||||
|
||||
double get_relative_time(struct MPContext *mpctx)
|
||||
{
|
||||
int64_t new_time = mp_time_us();
|
||||
int64_t new_time = mp_time_ns();
|
||||
int64_t delta = new_time - mpctx->last_time;
|
||||
mpctx->last_time = new_time;
|
||||
return delta * 0.000001;
|
||||
return delta * 1e-9;
|
||||
}
|
||||
|
||||
void update_core_idle_state(struct MPContext *mpctx)
|
||||
|
||||
Reference in new issue
Block a user