JD2022-TU1/main/extern/Raki/Source/RakiTests/_Prospero/System/RakiTime.cpp

27 lines
709 B
C++

#include "Precompiled.h"
#include "RakiEngine/System/RakiTime.h"
#include <rtc.h>
namespace raki
{
/**
* @brief GetTime since start.
* @info With Prospero a tick is the smallest time unit which is one microsecond.
* @return A float_32 value witch contain the time since start in second.
*/
f32 Time::getTime()
{
static SceRtcTick tickCountAtStart = {};
SceRtcTick now = {};
if (__builtin_expect(!tickCountAtStart.tick, 0))
{
sceRtcGetCurrentTick(&tickCountAtStart);
}
sceRtcGetCurrentTick(&now);
return static_cast<f32>(static_cast<f32>(now.tick - tickCountAtStart.tick) / 1000000.f);
}
}