From 91c979cca2e101f6ca5bc6507bd8bd08fd3fac15 Mon Sep 17 00:00:00 2001 From: atef Date: Mon, 24 Jul 2023 10:55:58 +0200 Subject: [PATCH] add roundto to unixTime --- csharp/Lib/Time/Unix/UnixTime.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/csharp/Lib/Time/Unix/UnixTime.cs b/csharp/Lib/Time/Unix/UnixTime.cs index f771fd01d..b370ad764 100644 --- a/csharp/Lib/Time/Unix/UnixTime.cs +++ b/csharp/Lib/Time/Unix/UnixTime.cs @@ -8,5 +8,7 @@ public readonly partial struct UnixTime { // IMPORTANT: init is necessary for JSON deserializer // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global - public UInt32 Ticks { get; init; } + public UInt32 Ticks { get; init; } + + public UnixTime RoundTo(UnixTimeSpan span) => Epoch + this / span * span; } \ No newline at end of file