Archived
1
0
Fork 0
forked from Mirror/Ryujinx
This repository has been archived on 2024-10-11. You can view files and clone it, but cannot push or open issues or pull requests.
jinx/Ryujinx.HLE/HOS/Services/Time/Clock/TickBasedSteadyClockCore.cs

35 lines
1,002 B
C#
Raw Normal View History

using Ryujinx.HLE.HOS.Kernel.Threading;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
class TickBasedSteadyClockCore : SteadyClockCore
{
public TickBasedSteadyClockCore() {}
public override SteadyClockTimePoint GetTimePoint(KThread thread)
{
SteadyClockTimePoint result = new SteadyClockTimePoint
{
TimePoint = 0,
ClockSourceId = GetClockSourceId()
};
TimeSpanType ticksTimeSpan;
// As this may be called before the guest code, we support passing a null thread to make this api usable.
if (thread == null)
{
ticksTimeSpan = TimeSpanType.FromSeconds(0);
}
else
{
ticksTimeSpan = TimeSpanType.FromTicks(thread.Context.CntpctEl0, thread.Context.CntfrqEl0);
}
result.TimePoint = ticksTimeSpan.ToSeconds();
return result;
}
}
}