Change "GetMillisecondsSinceClassCreation" to "GetNanosecondsSinceClassCreation"

This commit is contained in:
Alex 2023-04-23 07:29:08 +03:00
parent fcbb298077
commit 8471126696
Signed by untrusted user who does not match committer: enderice2
GPG Key ID: EACC3AD603BAB4DD
4 changed files with 12 additions and 9 deletions

View File

@ -55,10 +55,13 @@ namespace Time
#endif
}
uint64_t HighPrecisionEventTimer::GetMillisecondsSinceClassCreation()
uint64_t HighPrecisionEventTimer::GetNanosecondsSinceClassCreation()
{
#if defined(a86)
return (this->GetCounter() - this->ClassCreationTime) / (this->clk / this->ConvertUnit(Units::Milliseconds));
uint64_t Subtraction = this->GetCounter() - this->ClassCreationTime;
if (Subtraction <= 0 || this->clk <= 0)
return 0;
return Subtraction / (this->clk / ConvertUnit(Units::Nanoseconds));
#endif
}

View File

@ -55,7 +55,7 @@ namespace Time
#endif
}
uint64_t TimeStampCounter::GetMillisecondsSinceClassCreation()
uint64_t TimeStampCounter::GetNanosecondsSinceClassCreation()
{
#if defined(a86)
return (this->GetCounter() - this->ClassCreationTime) / this->clk;

View File

@ -118,7 +118,7 @@ namespace Time
}
}
uint64_t time::GetMillisecondsSinceClassCreation()
uint64_t time::GetNanosecondsSinceClassCreation()
{
switch (ActiveTimer)
{
@ -132,7 +132,7 @@ namespace Time
fixme("PIT sleep not implemented");
return false;
case HPET:
return this->hpet->GetMillisecondsSinceClassCreation();
return this->hpet->GetNanosecondsSinceClassCreation();
case ACPI:
fixme("ACPI sleep not implemented");
return false;
@ -140,7 +140,7 @@ namespace Time
fixme("APIC sleep not implemented");
return false;
case TSC:
return this->tsc->GetMillisecondsSinceClassCreation();
return this->tsc->GetNanosecondsSinceClassCreation();
default:
error("Unknown timer");
return false;

View File

@ -103,7 +103,7 @@ namespace Time
bool Sleep(uint64_t Duration, Units Unit);
uint64_t GetCounter();
uint64_t CalculateTarget(uint64_t Target, Units Unit);
uint64_t GetMillisecondsSinceClassCreation();
uint64_t GetNanosecondsSinceClassCreation();
HighPrecisionEventTimer(void *hpet);
~HighPrecisionEventTimer();
@ -151,7 +151,7 @@ namespace Time
bool Sleep(uint64_t Duration, Units Unit);
uint64_t GetCounter();
uint64_t CalculateTarget(uint64_t Target, Units Unit);
uint64_t GetMillisecondsSinceClassCreation();
uint64_t GetNanosecondsSinceClassCreation();
TimeStampCounter();
~TimeStampCounter();
@ -192,7 +192,7 @@ namespace Time
bool Sleep(uint64_t Duration, Units Unit);
uint64_t GetCounter();
uint64_t CalculateTarget(uint64_t Target, Units Unit);
uint64_t GetMillisecondsSinceClassCreation();
uint64_t GetNanosecondsSinceClassCreation();
void FindTimers(void *acpi);
time();
~time();