Пример #1
0
        /// <summary>
        /// GPS时间转儒略日
        /// </summary>
        public static void tmGPSTimeToJulianDay(GPSTIME pGPSTime, JULIANDAY pJulianDay)
        {
            double dTemp;

            dTemp = pGPSTime.lWeek * 7L + (double)pGPSTime.lSecond / 86400.0
                    + pGPSTime.dFraction;

            pJulianDay.lDay      = (long)(dTemp + 2444244.5);
            pJulianDay.lSecond   = (pGPSTime.lSecond % 86400 + 43200L) % 86400L;
            pJulianDay.dFraction = pGPSTime.dFraction;
        }
Пример #2
0
        /// <summary>
        /// GPS时间转日历时
        /// </summary>
        public static void tmGPSTimeToTime(ref GPSTIME pGPSTime, ref TIME pTime)
        {
            JULIANDAY jd;
            double    dTemp;

            dTemp = pGPSTime.lWeek * 7L + (double)pGPSTime.lSecond / 86400.0
                    + pGPSTime.dFraction / 86400.0;

            jd.lDay      = (long)(dTemp + 2444244.5);
            jd.lSecond   = (pGPSTime.lSecond % 86400 + 43200L) % 86400L;
            jd.dFraction = pGPSTime.dFraction;

            tmJulianDayToTime(ref jd, ref pTime);
        }
Пример #3
0
        /// <summary>
        /// 儒略日转GPS时间
        /// </summary>
        public static void tmJulianDayToGPSTime(JULIANDAY pJulianDay, GPSTIME pGPSTime)
        {
            double dTemp;
            long   lTemp;

            dTemp = pJulianDay.lDay +
                    (double)(pJulianDay.lSecond + pJulianDay.dFraction) / 86400.0;
            lTemp = (long)(dTemp - 2444244.5);

            pGPSTime.lWeek   = (long)((lTemp) / 7);
            pGPSTime.lSecond = (long)(lTemp % 7 * 86400L)
                               + (pJulianDay.lSecond + 43200L) % 86400L;
            pGPSTime.dFraction = pJulianDay.dFraction;
        }
Пример #4
0
        /// <summary>
        /// 日历时转GPS时间
        /// </summary>
        public static void tmTimeToGPSTime(ref TIME pTime, ref GPSTIME pGPSTime)
        {
            JULIANDAY jd;
            double    dTemp;
            long      lTemp;

            jd.dFraction = 0.0;
            jd.lDay      = 0;
            jd.lSecond   = 0;

            tmTimeToJulianDay(ref pTime, ref jd);
            dTemp = jd.lDay + (double)(jd.lSecond + jd.dFraction) / 86400.0;
            lTemp = (long)(dTemp - 2444244.5);

            pGPSTime.lWeek   = (long)((lTemp) / 7);
            pGPSTime.lSecond = (long)(lTemp % 7 * 86400L) + pTime.byHour * 3600L
                               + pTime.byMinute * 60L + (long)pTime.dSecond;
            pGPSTime.dFraction = pTime.dSecond - (long)pTime.dSecond;
        }