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/SteadyClockCore.cs
Thomas Guillemard 54b79dffa8 Implement time:* 4.0.0 commands (#736)
* Abstract SteadyClockCore to follow Nintendo changes in 4.x

This is the ground work for 4.0.0 support

* Implement TickBasedSteadyClockCore

Preparation for the ephemeral clock.

* Refactor SystemClockCore to follow 4.0.0 changes

* Implement EphemeralNetworkSystemClock

* Implement GetSnapshotClock & GetSnapshotClockFromSystemClockContext

* Implement CalculateStandardUserSystemClockDifferenceByUser & CalculateSpanBetween

* Remove an outdated comment & unused import

* Fix a nit and GetClockSnapshot

* Address comment
2019-07-25 11:44:51 -03:00

62 lines
1.5 KiB
C#

using Ryujinx.HLE.HOS.Kernel.Threading;
using Ryujinx.HLE.Utilities;
using System;
namespace Ryujinx.HLE.HOS.Services.Time.Clock
{
abstract class SteadyClockCore
{
private UInt128 _clockSourceId;
public SteadyClockCore()
{
_clockSourceId = new UInt128(Guid.NewGuid().ToByteArray());
}
public UInt128 GetClockSourceId()
{
return _clockSourceId;
}
public virtual TimeSpanType GetTestOffset()
{
return new TimeSpanType(0);
}
public virtual void SetTestOffset(TimeSpanType testOffset) {}
public virtual ResultCode GetRtcValue(out ulong rtcValue)
{
rtcValue = 0;
return ResultCode.NotImplemented;
}
public virtual ResultCode GetSetupResultValue()
{
return ResultCode.NotImplemented;
}
public virtual TimeSpanType GetInternalOffset()
{
return new TimeSpanType(0);
}
public virtual void SetInternalOffset(TimeSpanType internalOffset) {}
public virtual SteadyClockTimePoint GetTimePoint(KThread thread)
{
throw new NotImplementedException();
}
public SteadyClockTimePoint GetCurrentTimePoint(KThread thread)
{
SteadyClockTimePoint result = GetTimePoint(thread);
result.TimePoint += GetTestOffset().ToSeconds();
result.TimePoint += GetInternalOffset().ToSeconds();
return result;
}
}
}