JD2022-TU1/main/extern/libvpx/custom/vpx_ports/vpx_timer.cpp

34 lines
604 B
C++

/*
Because the NX os only provides c++ level headers, this c++ wrapper is needed for accessing the OS timing facilities from C code.
*/
#if NX
#include "vpx_config.h"
#include "vpx_timer.h"
#include <nn/os.h>
using namespace nn::os;
void vpx_usec_timer_start(struct vpx_usec_timer *t)
{
t->begin = GetSystemTick().GetInt64Value();
}
void vpx_usec_timer_mark(struct vpx_usec_timer *t)
{
t->end = GetSystemTick().GetInt64Value();
}
int64_t vpx_usec_timer_elapsed(struct vpx_usec_timer *t)
{
return ConvertToTimeSpan(Tick(t->end) - Tick(t->begin)).GetMicroSeconds();
}
#endif // NX