private static DateTime computeHMS(long jd, DateTime?badValue)
        {
            DateTime dateTime;

            if (!SQLiteConvert.isValidJd(jd))
            {
                if (!badValue.HasValue)
                {
                    throw new ArgumentException("Not a supported Julian Day value.");
                }
                return(badValue.Value);
            }
            int     num  = (int)((jd + (long)43200000) % (long)86400000);
            decimal num1 = num / new decimal(10000, 0, 0, false, 1);

            num = (int)num1;
            int num2 = (int)((num1 - num) * new decimal(10000, 0, 0, false, 1));

            num1 -= num;
            int num3 = num / 3600;

            num = num - num3 * 3600;
            int num4 = num / 60;

            num1 = num1 + (num - num4 * 60);
            int num5 = (int)num1;

            try
            {
                DateTime minValue = DateTime.MinValue;
                dateTime = new DateTime(minValue.Year, minValue.Month, minValue.Day, num3, num4, num5, num2);
            }
            catch
            {
                if (!badValue.HasValue)
                {
                    throw;
                }
                dateTime = badValue.Value;
            }
            return(dateTime);
        }
        private static DateTime computeYMD(long jd, DateTime?badValue)
        {
            DateTime dateTime;

            if (!SQLiteConvert.isValidJd(jd))
            {
                if (!badValue.HasValue)
                {
                    throw new ArgumentException("Not a supported Julian Day value.");
                }
                return(badValue.Value);
            }
            int num  = (int)((jd + (long)43200000) / (long)86400000);
            int num1 = (int)(((double)num - 1867216.25) / 36524.25);

            num1 = num + 1 + num1 - num1 / 4;
            int num2 = num1 + 1524;
            int num3 = (int)(((double)num2 - 122.1) / 365.25);
            int num4 = 36525 * num3 / 100;
            int num5 = (int)((double)(num2 - num4) / 30.6001);
            int num6 = (int)(30.6001 * (double)num5);
            int num7 = num2 - num4 - num6;
            int num8 = (num5 < 14 ? num5 - 1 : num5 - 13);
            int num9 = (num8 > 2 ? num3 - 4716 : num3 - 4715);

            try
            {
                dateTime = new DateTime(num9, num8, num7);
            }
            catch
            {
                if (!badValue.HasValue)
                {
                    throw;
                }
                dateTime = badValue.Value;
            }
            return(dateTime);
        }