Пример #1
0
        private static double CurrentJulianDate()
        {
            JulianCalendar cal       = new JulianCalendar();
            int            isJanFeb  = (14 - cal.GetMonth(DateTime.UtcNow)) / 12;
            int            years     = cal.GetYear(DateTime.UtcNow) + 4800 - isJanFeb;
            int            monthsMod = cal.GetMonth(DateTime.UtcNow) + (12 * isJanFeb) - 3;

            double dayNumber =
                cal.GetDayOfMonth(DateTime.UtcNow)
                + Math.Floor((double)(153 * monthsMod + 2) / 5)
                + 365 * years + Math.Floor((double)years / 4) - 32083;

            double julianDate = dayNumber
                                + ((double)cal.GetHour(DateTime.UtcNow) - 12) / 24
                                + (double)cal.GetMinute(DateTime.UtcNow) / 1440
                                + (double)cal.GetSecond(DateTime.UtcNow) / 86400;

            return(julianDate);
        }