public void TestDaysDifference() { double totalElapsedTime = TimeConstants.SecondsPerDay * 2.5; double totalElapsedTimeDays = totalElapsedTime / TimeConstants.SecondsPerDay; //Test same time standard, both safe JulianDate first = new JulianDate(2451545.0); JulianDate second = first + Duration.FromSeconds(totalElapsedTime); Assert.AreEqual(totalElapsedTimeDays, first.DaysDifference(second)); Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerDay, first.DaysDifference(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(totalElapsedTimeDays, first.DaysDifference(second)); Assert.AreEqual((second - first).TotalSeconds / TimeConstants.SecondsPerDay, first.DaysDifference(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(totalElapsedTimeDays, first.DaysDifference(secondDiffStandard)); Assert.AreEqual((secondDiffStandard - first).TotalSeconds / TimeConstants.SecondsPerDay, first.DaysDifference(secondDiffStandard)); first = JulianDate.MinValue; second = JulianDate.MaxValue; Assert.AreEqual((long)int.MaxValue - int.MinValue, first.DaysDifference(second)); }