[*] 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

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

View File

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