2019-07-14 16:50:11 -04:00
|
|
|
|
using Ryujinx.HLE.HOS.Kernel.Threading;
|
|
|
|
|
using Ryujinx.HLE.Utilities;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace Ryujinx.HLE.HOS.Services.Time.Clock
|
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
abstract class SteadyClockCore
|
2019-07-14 16:50:11 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
private UInt128 _clockSourceId;
|
2019-07-14 16:50:11 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public SteadyClockCore()
|
2019-07-14 16:50:11 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
_clockSourceId = new UInt128(Guid.NewGuid().ToByteArray());
|
2019-07-14 16:50:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public UInt128 GetClockSourceId()
|
|
|
|
|
{
|
|
|
|
|
return _clockSourceId;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual TimeSpanType GetTestOffset()
|
2019-07-14 16:50:11 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
return new TimeSpanType(0);
|
2019-07-14 16:50:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual void SetTestOffset(TimeSpanType testOffset) {}
|
2019-07-14 16:50:11 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual ResultCode GetRtcValue(out ulong rtcValue)
|
2019-07-15 13:52:35 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
rtcValue = 0;
|
2019-07-15 13:52:35 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
return ResultCode.NotImplemented;
|
2019-07-15 13:52:35 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual ResultCode GetSetupResultValue()
|
2019-07-15 13:52:35 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
return ResultCode.NotImplemented;
|
2019-07-15 13:52:35 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual TimeSpanType GetInternalOffset()
|
2019-07-14 16:50:11 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
return new TimeSpanType(0);
|
2019-07-14 16:50:11 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual void SetInternalOffset(TimeSpanType internalOffset) {}
|
2019-07-15 13:52:35 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public virtual SteadyClockTimePoint GetTimePoint(KThread thread)
|
2019-07-15 13:52:35 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
throw new NotImplementedException();
|
2019-07-15 13:52:35 -04:00
|
|
|
|
}
|
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
public SteadyClockTimePoint GetCurrentTimePoint(KThread thread)
|
2019-07-15 13:52:35 -04:00
|
|
|
|
{
|
2019-07-25 10:44:51 -04:00
|
|
|
|
SteadyClockTimePoint result = GetTimePoint(thread);
|
2019-07-15 13:52:35 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
result.TimePoint += GetTestOffset().ToSeconds();
|
|
|
|
|
result.TimePoint += GetInternalOffset().ToSeconds();
|
2019-07-15 13:52:35 -04:00
|
|
|
|
|
2019-07-25 10:44:51 -04:00
|
|
|
|
return result;
|
2019-07-15 13:52:35 -04:00
|
|
|
|
}
|
2019-07-14 16:50:11 -04:00
|
|
|
|
}
|
|
|
|
|
}
|