ISystemClock.cs 784 B

123456789101112131415161718192021222324252627282930
  1. using Ryujinx.OsHle.Ipc;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace Ryujinx.OsHle.Objects.Time
  5. {
  6. class ISystemClock : IIpcInterface
  7. {
  8. private Dictionary<int, ServiceProcessRequest> m_Commands;
  9. public IReadOnlyDictionary<int, ServiceProcessRequest> Commands => m_Commands;
  10. private static DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
  11. public ISystemClock()
  12. {
  13. m_Commands = new Dictionary<int, ServiceProcessRequest>()
  14. {
  15. { 0, GetCurrentTime }
  16. };
  17. }
  18. public long GetCurrentTime(ServiceCtx Context)
  19. {
  20. Context.ResponseData.Write((long)(DateTime.Now - Epoch).TotalSeconds);
  21. return 0;
  22. }
  23. }
  24. }