public static void AssertNoTruncation(IHasTimeComponents time, string target) { if (time.Nanosecond % NanosecondsPerTick > 0) { throw new ValueTruncationException( $"Conversion of this instance ({time}) into {target} will cause a truncation of {time.Nanosecond % TemporalHelpers.NanosecondsPerTick}ns."); } }
internal OffsetTime(IHasTimeComponents time, int offsetSeconds) : this(time.Hour, time.Minute, time.Second, time.Nanosecond, offsetSeconds) { }
public static int ToSecondsOfDay(this IHasTimeComponents time) { return((time.Hour * SecondsPerHour) + (time.Minute * SecondsPerMinute) + time.Second); }
public static long ToNanoOfDay(this IHasTimeComponents time) { return((time.Hour * NanosPerHour) + (time.Minute * NanosPerMinute) + (time.Second * NanosPerSecond) + time.Nanosecond); }