[+] DispatchTimeFromAuSteadyAbsNS

This commit is contained in:
Reece Wilson 2023-11-04 04:43:55 +00:00
parent 5041b2f241
commit 0331c7cf87

View File

@ -43,6 +43,17 @@ namespace Aurora::Time
#elif defined(AURORA_IS_POSIX_DERIVED) #elif defined(AURORA_IS_POSIX_DERIVED)
#if defined(AURORA_IS_XNU_DERIVED)
static dispatch_time_t DispatchTimeFromAuSteadyAbsNS(AuUInt64 uSteadyTimeABSNS)
{
AuUInt64 uRet {};
uRet = uSteadyTimeABSNS / (1000000000ull / SteadyClockJiffies());
uRet &= ~((1ull << 63ull) | (1ull << 62ull));
uRet |= (1ull << 63ull);
return (dispatch_time_t)uRet;
}
#endif
static AuInt64 ConvertUnixTimespecToMs(const struct timespec &spec) static AuInt64 ConvertUnixTimespecToMs(const struct timespec &spec)
{ {
return ConvertUnixToAuroraMS(spec.tv_sec * 1000ULL + spec.tv_nsec / 1000000ULL); return ConvertUnixToAuroraMS(spec.tv_sec * 1000ULL + spec.tv_nsec / 1000000ULL);