2019-09-18 20:45:11 -04:00
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
2019-07-25 10:44:51 -04:00
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
|
|
|
|
{
|
|
|
|
|
class TickBasedSteadyClockCore : SteadyClockCore
|
|
|
|
|
{
|
2019-10-07 23:48:49 -04:00
|
|
|
|
public TickBasedSteadyClockCore() {}
|
2019-07-25 10:44:51 -04:00
|
|
|
|
|
|
|
|
|
public override SteadyClockTimePoint GetTimePoint(KThread thread)
|
|
|
|
|
{
|
|
|
|
|
SteadyClockTimePoint result = new SteadyClockTimePoint
|
|
|
|
|
{
|
|
|
|
|
TimePoint = 0,
|
|
|
|
|
ClockSourceId = GetClockSourceId()
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-07 23:48:49 -04:00
|
|
|
|
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);
|
|
|
|
|
}
|
2019-07-25 10:44:51 -04:00
|
|
|
|
|
|
|
|
|
result.TimePoint = ticksTimeSpan.ToSeconds();
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|