Exemple #1
0
        // This is an optimization that removes a lot of division operations, which are costly.
        float DivideTimeByFinalSplit(Time time)
        {
            // Just to prevent crashing. This should not occur.
            if (IsTimeEmpty(FinalSplitTime))
            {
                return(0);
            }

            TimeSpan timeSpan;
            double   inversePBMillis;

            if (ActualTimingMethod.Equals(TimingMethod.RealTime))
            {
                timeSpan        = time.RealTime ?? TimeSpan.Zero;
                inversePBMillis = InverseFinalRealTimeMillis;
            }
            else
            {
                timeSpan        = time.GameTime ?? TimeSpan.Zero;
                inversePBMillis = InverseFinalGameTimeMillis;
            }

            if (timeSpan.Equals(TimeSpan.Zero))
            {
                return(0);
            }

            return((float)(timeSpan.TotalMilliseconds * inversePBMillis));
        }
Exemple #2
0
 // Determine if a given split does not have an associated time for the current timing
 // method.
 bool IsTimeEmpty(Time time)
 {
     if (ActualTimingMethod.Equals(TimingMethod.RealTime))
     {
         return(time.RealTime == null);
     }
     else
     {
         return(time.GameTime == null);
     }
 }