Innovenergy_trunk/csharp/Lib/Time/Unix/UnixTime.cs

14 lines
376 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
// ReSharper disable ArrangeStaticMemberQualifier
namespace InnovEnergy.Lib.Time.Unix;
2023-02-16 12:57:06 +00:00
public readonly partial struct UnixTime
{
// IMPORTANT: init is necessary for JSON deserializer
// ReSharper disable once AutoPropertyCanBeMadeGetOnly.Global
2023-07-24 08:55:58 +00:00
public UInt32 Ticks { get; init; }
public UnixTime RoundTo(UnixTimeSpan span) => Epoch + this / span * span;
2023-02-16 12:57:06 +00:00
}