getJulianDay method

double getJulianDay()

获取儒略日 @return 儒略日

Implementation

double getJulianDay() {
  int y = _year;
  int m = _month;
  double d = _day + ((_second * 1.0 / 60 + _minute) / 60 + _hour) / 24;
  int n = 0;
  bool g = false;
  if (y * 372 + m * 31 + d.floor() >= 588829) {
    g = true;
  }
  if (m <= 2) {
    m += 12;
    y--;
  }
  if (g) {
    n = (y * 1.0 / 100).floor();
    n = 2 - n + (n * 1.0 / 4).floor();
  }
  return ((365.25 * (y + 4716)).floor()) +
      ((30.6001 * (m + 1)).floor()) +
      d +
      n -
      1524.5;
}