[*] Amend process creation time. I did a dumb. (bdec6ff8)

This commit is contained in:
Reece Wilson 2023-07-10 21:37:28 +01:00
parent 66b948697b
commit d6739f5196
2 changed files with 10 additions and 8 deletions

View File

@ -68,6 +68,8 @@ static void Init()
Crypto::InitCrypto();
Aurora::IO::TLS::TLSInit();
(void)AuProcess::GetProcessStartupTimeMS();
Aurora::Threading::InitSleep();
Aurora::Process::InitProcess();

View File

@ -7,6 +7,7 @@
***/
#include <Source/RuntimeInternal.hpp>
#include "AuProcessStartTime.hpp"
#include <Time/Time.hpp>
namespace Aurora::Process
{
@ -19,16 +20,15 @@ namespace Aurora::Process
return optKnownWallTime.value();
}
auto uUptime = AuTime::ProcessClockNS();
if (!uUptime)
#if defined(AURORA_IS_MODERNNT_DERIVED)
FILETIME creation, exit, kernel, user;
if (::GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user))
{
optKnownWallTime = AuTime::CurrentClockNS();
}
else
{
optKnownWallTime = AuTime::CurrentClockNS() - uUptime;
optKnownWallTime = AuTime::ConvertTimestampNs(creation);
}
#else
optKnownWallTime = AuTime::CurrentClockNS() - AuTime::ThreadClockNS();
#endif
return optKnownWallTime.value();
}