mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-15 13:40:39 +08:00
[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:
@@ -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
|
||||
|
Reference in New Issue
Block a user