Пример #1
0
 TimeSpan WaitTimeWithDrift()
 {
     return(Ticks.ToTimeSpan(Math.Max(
                                 Ticks.FromTimeSpan(BackoffTimeoutHelper.defaultInitialWaitTime),
                                 Ticks.Add(Ticks.FromTimeSpan(this.waitTime),
                                           (long)(uint)this.random.Next() % (2 * BackoffTimeoutHelper.maxDriftTicks + 1) - BackoffTimeoutHelper.maxDriftTicks))));
 }
Пример #2
0
 public static TimeSpan Divide(TimeSpan timeout, int factor)
 {
     if (timeout == TimeSpan.MaxValue)
     {
         return(TimeSpan.MaxValue);
     }
     return(Ticks.ToTimeSpan((Ticks.FromTimeSpan(timeout) / ((long)factor)) + 1L));
 }
Пример #3
0
 public static TimeSpan Divide(TimeSpan timeout, int factor)
 {
     if (timeout != TimeSpan.MaxValue)
     {
         return(Ticks.ToTimeSpan(Ticks.FromTimeSpan(timeout) / (long)factor + (long)1));
     }
     else
     {
         return(TimeSpan.MaxValue);
     }
 }
Пример #4
0
 public static TimeSpan Add(TimeSpan timeout1, TimeSpan timeout2)
 {
     return(Ticks.ToTimeSpan(Ticks.Add(Ticks.FromTimeSpan(timeout1), Ticks.FromTimeSpan(timeout2))));
 }
Пример #5
0
 private TimeSpan WaitTimeWithDrift()
 {
     return(Ticks.ToTimeSpan(Math.Max(Ticks.FromTimeSpan(defaultInitialWaitTime), Ticks.Add(Ticks.FromTimeSpan(this.waitTime), ((long)(((ulong)this.random.Next()) % ((2L * maxDriftTicks) + 1L))) - maxDriftTicks))));
 }