Exemple #1
0
        public void TestSubtractSeconds()
        {
            // Make sure SubtractSeconds produces the correct answer in the correct time standard.
            JulianDate test   = new JulianDate(2451912, 0.0, TimeStandard.InternationalAtomicTime);
            JulianDate result = test.SubtractSeconds(43200.25);

            Assert.AreEqual(TimeStandard.InternationalAtomicTime, result.Standard);
            Assert.AreEqual(2451911, result.Day);
            Assert.AreEqual(43199.75, result.SecondsOfDay);
        }
Exemple #2
0
        public void TestSecondsDifferenceAtLeapSecond()
        {
            JulianDate leapSecond = new JulianDate(2453736, 43232, TimeStandard.InternationalAtomicTime);
            JulianDate utcDate    = new JulianDate(2453736, 43232, TimeStandard.CoordinatedUniversalTime);

            Assert.AreEqual(-33, utcDate.SecondsDifference(leapSecond));
            Assert.AreEqual(33, leapSecond.SecondsDifference(utcDate));

            JulianDate secondBeforeLeapSecondUTC = leapSecond.SubtractSeconds(1).ToTimeStandard(TimeStandard.CoordinatedUniversalTime);
            JulianDate secondAfterLeapSecondUTC  = leapSecond.AddSeconds(1).ToTimeStandard(TimeStandard.CoordinatedUniversalTime);

            Assert.AreEqual(2, secondBeforeLeapSecondUTC.SecondsDifference(secondAfterLeapSecondUTC));
            Assert.AreEqual(2, secondAfterLeapSecondUTC.Subtract(secondBeforeLeapSecondUTC).Seconds);
        }
        public void TestSecondsDifferenceAtLeapSecond()
        {
            JulianDate leapSecond = new JulianDate(2453736, 43232, TimeStandard.InternationalAtomicTime);
            JulianDate utcDate = new JulianDate(2453736, 43232, TimeStandard.CoordinatedUniversalTime);

            Assert.AreEqual(-33, utcDate.SecondsDifference(leapSecond));
            Assert.AreEqual(33, leapSecond.SecondsDifference(utcDate));

            JulianDate secondBeforeLeapSecondUTC = leapSecond.SubtractSeconds(1).ToTimeStandard(TimeStandard.CoordinatedUniversalTime);
            JulianDate secondAfterLeapSecondUTC = leapSecond.AddSeconds(1).ToTimeStandard(TimeStandard.CoordinatedUniversalTime);

            Assert.AreEqual(2, secondBeforeLeapSecondUTC.SecondsDifference(secondAfterLeapSecondUTC));
            Assert.AreEqual(2, secondAfterLeapSecondUTC.Subtract(secondBeforeLeapSecondUTC).Seconds);
        }