[+] AuProcess::GetProcessStartupSteadyTimeNS()
This commit is contained in:
parent
1652231fd4
commit
a5f4d959be
@ -11,11 +11,16 @@ namespace Aurora::Process
|
||||
{
|
||||
/**
|
||||
* @brief Defer to the AuTime namespace to convert the return unsigned integer to something useful
|
||||
*/
|
||||
*/
|
||||
AUKN_SYM AuUInt64 GetProcessStartupTimeNS();
|
||||
|
||||
/**
|
||||
* @brief Defer to the AuTime namespace to convert the return unsigned integer to something useful
|
||||
*/
|
||||
*/
|
||||
AUKN_SYM AuUInt64 GetProcessStartupTimeMS();
|
||||
|
||||
/**
|
||||
* @brief Defer to AuTime::SteadyClockNS()
|
||||
*/
|
||||
AUKN_SYM AuUInt64 GetProcessStartupSteadyTimeNS();
|
||||
}
|
@ -73,6 +73,7 @@ static void Init()
|
||||
Aurora::IO::TLS::TLSInit();
|
||||
|
||||
(void)AuProcess::GetProcessStartupTimeMS();
|
||||
(void)AuProcess::GetProcessStartupSteadyTimeNS();
|
||||
|
||||
Aurora::Threading::InitSleep();
|
||||
Aurora::Process::InitProcess();
|
||||
|
@ -37,4 +37,28 @@ namespace Aurora::Process
|
||||
{
|
||||
return AuNSToMS<AuUInt64>(GetProcessStartupTimeNS());
|
||||
}
|
||||
|
||||
AUKN_SYM AuUInt64 GetProcessStartupSteadyTimeNS()
|
||||
{
|
||||
static AuOptional<AuUInt64> optKnownTime;
|
||||
|
||||
if (optKnownTime.has_value())
|
||||
{
|
||||
return optKnownTime.value();
|
||||
}
|
||||
|
||||
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
||||
FILETIME creation, exit, kernel, user;
|
||||
if (::GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user))
|
||||
{
|
||||
auto u64 = AuTime::ConvertTimestampNs(creation);
|
||||
u64 += AuTime::SteadyClockNS() - AuTime::CurrentClockNS();
|
||||
optKnownTime = u64;
|
||||
}
|
||||
#else
|
||||
optKnownTime = AuTime::SteadyClockNS() - AuTime::ThreadClockNS();
|
||||
#endif
|
||||
|
||||
return optKnownTime.value();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user