diff --git a/common/msg.c b/common/msg.c index d1128c71bd..2dc4c1e7c2 100644 --- a/common/msg.c +++ b/common/msg.c @@ -316,7 +316,7 @@ static void print_terminal_line(struct mp_log *log, int lev, set_msg_color(stream, lev); if (root->show_time) - fprintf(stream, "[%10.6f] ", (mp_time_us() - MP_START_TIME) / 1e6); + fprintf(stream, "[%10.6f] ", (mp_time_ns() - MP_START_TIME) / 1e9); const char *prefix = log->prefix; if ((lev >= MSGL_V) || root->verbose || root->module) @@ -405,7 +405,7 @@ static void dump_stats(struct mp_log *log, int lev, char *text) { struct mp_log_root *root = log->root; if (lev == MSGL_STATS && root->stats_file) - fprintf(root->stats_file, "%"PRId64" %s\n", mp_time_us(), text); + fprintf(root->stats_file, "%"PRId64" %s\n", mp_time_ns(), text); } void mp_msg_va(struct mp_log *log, int lev, const char *format, va_list va) @@ -551,7 +551,7 @@ static void *log_file_thread(void *p) if (e) { pthread_mutex_unlock(&root->log_file_lock); fprintf(root->log_file, "[%8.3f][%c][%s] %s", - (mp_time_us() - MP_START_TIME) / 1e6, + (mp_time_ns() - MP_START_TIME) / 1e9, mp_log_levels[e->level][0], e->prefix, e->text); fflush(root->log_file); pthread_mutex_lock(&root->log_file_lock); diff --git a/osdep/timer.h b/osdep/timer.h index 546d8fab41..d76ad16129 100644 --- a/osdep/timer.h +++ b/osdep/timer.h @@ -48,7 +48,7 @@ int mp_start_hires_timers(int wait_ms); void mp_end_hires_timers(int resolution_ms); #endif /* _WIN32 */ -#define MP_START_TIME 10000000 +#define MP_START_TIME 10 * INT64_C(1000000000) // Duration of a second in mpv time. #define MP_SECOND_US (1000 * 1000)