From 5de84414d265352dfc338ef59fc879ba025157a5 Mon Sep 17 00:00:00 2001 From: CrackThrough Date: Thu, 8 Dec 2022 00:35:43 +0900 Subject: [PATCH] feat: GetTimeInTicks() --- Runtime/Event.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Runtime/Event.cs b/Runtime/Event.cs index 61fa47d..79b03e1 100644 --- a/Runtime/Event.cs +++ b/Runtime/Event.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; @@ -8,8 +9,13 @@ namespace SkyHook /// [StructLayout(LayoutKind.Sequential)] [SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] - public struct SkyHookEvent + public readonly struct SkyHookEvent { + /// + /// Epoch ticks to append in . + /// + private static readonly long EpochTicks = new DateTime(1970, 1, 1).Ticks; + /// /// Precise time of the key's state update in seconds. /// @@ -30,6 +36,13 @@ namespace SkyHook /// The key number that was pressed or released. /// public readonly ushort Key; + + /// + /// Returns the sum of and in ticks. + /// + /// The sum of and in ticks. + public long GetTimeInTicks() + => (TimeSec * 10000000) + (TimeSubsecNano / 100) + EpochTicks; } ///