Beispiel #1
0
        public void TestMinutesDifference()
        {
            double totalElapsedTime        = TimeConstants.SecondsPerDay * 2.5;
            double totalElapsedTimeMinutes = totalElapsedTime / TimeConstants.SecondsPerMinute;

            //Test same time standard, both safe
            JulianDate first  = new JulianDate(2451545.0);
            JulianDate second = first + Duration.FromSeconds(totalElapsedTime);

            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(second));
            Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(second));

            //Test same time standard, both unsafe
            first  = new JulianDate(2451545.0, TimeStandard.CoordinatedUniversalTime);
            second = first + Duration.FromSeconds(totalElapsedTime);
            second = new JulianDate(second.Day, second.SecondsOfDay, TimeStandard.CoordinatedUniversalTime);
            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(second));
            Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(second));

            //Test diff time standard, one safe, one unsafe
            first  = new JulianDate(2451545.0);
            second = first + Duration.FromSeconds(totalElapsedTime);
            JulianDate secondDiffStandard = second.ToTimeStandard(TimeStandard.CoordinatedUniversalTime);

            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(secondDiffStandard));
            Assert.AreEqual((secondDiffStandard - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(secondDiffStandard));

            first  = JulianDate.MinValue;
            second = JulianDate.MaxValue;
            Assert.AreEqual(((long)int.MaxValue - int.MinValue) * TimeConstants.MinutesPerDay, first.MinutesDifference(second));
        }
Beispiel #2
0
        public void TestMinutesDifference()
        {
            double totalElapsedTime = TimeConstants.SecondsPerDay * 2.5;
            double totalElapsedTimeMinutes = totalElapsedTime / TimeConstants.SecondsPerMinute;

            //Test same time standard, both safe
            JulianDate first = new JulianDate(2451545.0);
            JulianDate second = first + Duration.FromSeconds(totalElapsedTime);
            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(second));
            Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(second));

            //Test same time standard, both unsafe
            first = new JulianDate(2451545.0, TimeStandard.CoordinatedUniversalTime);
            second = first + Duration.FromSeconds(totalElapsedTime);
            second = new JulianDate(second.Day, second.SecondsOfDay, TimeStandard.CoordinatedUniversalTime);
            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(second));
            Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(second));

            //Test diff time standard, one safe, one unsafe
            first = new JulianDate(2451545.0);
            second = first + Duration.FromSeconds(totalElapsedTime);
            JulianDate secondDiffStandard = second.ToTimeStandard(TimeStandard.CoordinatedUniversalTime);
            Assert.AreEqual(totalElapsedTimeMinutes, first.MinutesDifference(secondDiffStandard));
            Assert.AreEqual((secondDiffStandard - first).TotalSeconds / TimeConstants.SecondsPerMinute, first.MinutesDifference(secondDiffStandard));
        }