[osal]: Change time function

Change time function from gettimeofday to clock_gettime.
Output of mpp_time() is still in us.

Change-Id: I7f961bb7bb4007e8e42ae5358bd7f568edf6c3d0
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2018-03-23 09:14:40 +08:00
parent e648d65af8
commit ed4151e245
3 changed files with 49 additions and 4 deletions

View File

@@ -29,13 +29,13 @@ RK_S64 mpp_time()
}
#else
#include <sys/time.h>
#include <time.h>
RK_S64 mpp_time()
{
struct timeval tv_date;
gettimeofday(&tv_date, NULL);
return (RK_S64)tv_date.tv_sec * 1000000 + (RK_S64)tv_date.tv_usec;
struct timespec time = {0, 0};
clock_gettime(CLOCK_MONOTONIC, &time);
return (RK_S64)time.tv_sec * 1000000 + (RK_S64)time.tv_nsec / 1000;
}
#endif