コード例 #1
0
 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.");
     }
 }
コード例 #2
0
 internal OffsetTime(IHasTimeComponents time, int offsetSeconds)
     : this(time.Hour, time.Minute, time.Second, time.Nanosecond, offsetSeconds)
 {
 }
コード例 #3
0
 public static int ToSecondsOfDay(this IHasTimeComponents time)
 {
     return((time.Hour * SecondsPerHour) + (time.Minute * SecondsPerMinute) + time.Second);
 }
コード例 #4
0
 public static long ToNanoOfDay(this IHasTimeComponents time)
 {
     return((time.Hour * NanosPerHour) + (time.Minute * NanosPerMinute) + (time.Second * NanosPerSecond) +
            time.Nanosecond);
 }