Returns the Datetime of the maximum phase of the
    previous global lunar eclipse.
774523
def prevLunarEclipse(date):
    

    eclipse = swe.lunarEclipseGlobal(date.jd, backward=True)
    return Datetime.fromJD(eclipse['maximum'], date.utcoffset)
29672
@Override
  public Date getFinalFireTime ()
  {
    if (m_nRepeatCount == 0)
    {
      return m_aStartTime;
    }

    if (m_nRepeatCount == REPEAT_INDEFINITELY)
    {
      return (getEndTime () == null) ? null : getFireTimeBefore (getEndTime ());
    }

    final long lastTrigger = m_aStartTime.getTime () + (m_nRepeatCount * m_nRepeatInterval);

    if ((getEndTime () == null) || (lastTrigger < getEndTime ().getTime ()))
    {
      return new Date (lastTrigger);
    }
    return getFireTimeBefore (getEndTime ());
  }
95107
def elapsed(self):
        
        if not self.start_date:
            return None
        return (self.end_date or datetime.utcnow()) - self.start_date
651789
public long getSortDate() {

        long result = getDateLastModified();
        if (m_related != null) {
            for (CmsPublishResource rel : m_related) {
                result = Math.max(result, rel.getSortDate());
            }
        }
        return result;
    }
557068
def nextSunrise(date, pos):
    
    jd = eph.nextSunrise(date.jd, pos.lat, pos.lon)
    return Datetime.fromJD(jd, date.utcoffset)
485798
def maximum( self ):
        
        if ( self._maximum is not None ):
            return self._maximum
        
        rtype = self.rulerType()
        
        if ( rtype == XChartRuler.Type.Number ):
            self._maximum = 100
            
        elif ( rtype == XChartRuler.Type.Date ):
            self._maximum = QDate.currentDate().addDays(10)
        
        elif ( rtype == XChartRuler.Type.Datetime ):
            self._maximum = QDateTime.currentDateTime().addDays(10)
        
        elif ( rtype == XChartRuler.Type.Time ):
            self._maximum = QDateTime.currentDateTime().time().addSecs(60 * 60)
            
        else:
            notches = self.notches()
            if ( notches ):
                self._maximum = notches[-1]
                
        return self._maximum
327136
synchronized Weight getMaximumFinish() {
        if (calcMaxFinish == null) {
            // Find the longest distance from time zero to a finish.
            Weight result = WeightFactory.NEG_INFINITY;
            if (shortestDistancesFromTimeZeroSource == null) {
                shortestDistancesFromTimeZeroSource = BellmanFord.calcShortestDistances(timeZero, directedGraph,
                        BellmanFord.Mode.SOURCE);
                if (shortestDistancesFromTimeZeroSource == null) {
                    throw new IllegalStateException("Negative cycle detected!");
                }
            }
            for (int i = 0, n = intervals.size(); i < n; i++) {
                Object finish = intervals.get(i).getFinish();
                result = Weight.max(result,
                        (Weight) shortestDistancesFromTimeZeroSource.get(finish));
            }
            calcMaxFinish = result;
        }

        return calcMaxFinish;
    }
1072126
public long maxTimestamp()
  {
    return ranges == null
            ? topLevel.markedForDeleteAt
            : Math.max(topLevel.markedForDeleteAt, ranges.maxMarkedAt());
  }
1075419
def max_time(self):
        

        max_time = Time(self._interval_set.max / TimeMOC.DAY_MICRO_SEC, format='jd', scale='tdb')
        return max_time
1170658
function(d) {
    return d.wmStart || (d.wmStart = later.date.next(
      later.Y.val(d),
      later.M.val(d),
      Math.max(later.D.val(d) - later.dw.val(d) + 1, 1)));
  }
1161026
function(d) {
    return d.dcStart || (d.dcStart =
      later.date.next(
        later.Y.val(d),
        later.M.val(d),
        Math.max(1, ((later.dc.val(d) - 1) * 7) + 1 || 1)));
  }
948463
def last_modified(self):
        ''''''
        lm = self.response.headers.get('last-modified', None)
        return datetime.strptime(lm, '%a, %d %b %Y %H:%M:%S GMT') if lm \
            else None
806289
@Override
    public <V> V getMaximum(ChronoElement<V> element) {

        V max;

        if (this.timestamp.contains(element)) {
            max = this.timestamp.getMaximum(element);
        } else {
            max = this.moment.getMaximum(element);
        }

        if (
            (element == SECOND_OF_MINUTE)
            && (this.timestamp.getYear() >= 1972)
        ) {
            PlainTimestamp ts = this.timestamp.with(element, max);

            if (!this.zone.isInvalid(ts, ts)) {
                Moment transformed = ts.in(this.zone);
                Moment test = transformed.plus(1, SI.SECONDS);

                if (test.isLeapSecond()) {
                    return element.getType().cast(Integer.valueOf(60));
                }
            }
        }

        return max;

    }
634803
private long getTotalTime(ProjectCalendarDateRanges exception)
   {
      long total = 0;
      for (DateRange range : exception)
      {
         total += getTime(range.getStart(), range.getEnd());
      }
      return (total);
   }
1328126
double getHighestElevationOfSun(PlainDate date) {

        Moment noon = date.get(this.transitAtNoon());
        double jde = JulianDay.getValue(noon, TimeScale.TT);
        double decInRad = Math.toRadians(this.getCalculator().getFeature(jde, DECLINATION));
        double latInRad = Math.toRadians(this.latitude);
        double sinElevation = // Extra term left out => Math.cos(Math.toRadians(trueNoon)) := 1.0 (per definition)
            Math.sin(latInRad) * Math.sin(decInRad) + Math.cos(latInRad) * Math.cos(decInRad); // Meeus (13.6)
        double result = Math.toDegrees(Math.asin(sinElevation));

        if (Double.isNaN(result)) {
            throw new UnsupportedOperationException(
                "Solar declination not supported by: " + this.getCalculator().name());
        }

        return result;

    }
490940
@Override
    public boolean observesDaylightTime() {
        long current = System.currentTimeMillis();

        if (finalZone != null) {
            if (finalZone.useDaylightTime()) {
                return true;
            } else if (current >= finalStartMillis) {
                return false;
            }
        }

        // Return TRUE if DST is observed at any future time
        long currentSec = Grego.floorDivide(current, Grego.MILLIS_PER_SECOND);
        int trsIdx = transitionCount - 1;
        if (dstOffsetAt(trsIdx) != 0) {
            return true;
        }
        while (trsIdx >= 0) {
            if (transitionTimes64[trsIdx] <= currentSec) {
                break;
            }
            if (dstOffsetAt(trsIdx - 1) != 0) {
                return true;
            }
            trsIdx--;
        }
        return false;
    }
207176
public Moonlight on(CalendarDate date) {

        // initialization
        PlainDate d = SolarTime.toGregorian(date);
        Timezone tz = Timezone.of(this.observerZoneID);
        Moment start =
            ((tz.getHistory() == null)
                ? d.at(PlainTime.midnightAtStartOfDay()).in(tz)
                : d.atFirstMoment(this.observerZoneID));

        double mjd0 = JulianDay.ofMeanSolarTime(start).getMJD();
        double longitudeRad = Math.toRadians(this.longitude);
        double cosLatitude = Math.cos(Math.toRadians(this.latitude));
        double sinLatitude = Math.sin(Math.toRadians(this.latitude));
        double geodeticAngle = StdSolarCalculator.TIME4J.getGeodeticAngle(this.latitude, this.altitude);
        double refraction = AstroUtils.refractionFactorOfStdAtmosphere(this.altitude) * SolarTime.STD_REFRACTION / 60;
        double deltaT = TimeScale.deltaT(d);
        double hour = 1.0;
        double y_minus = sinAlt(mjd0, 0.0, longitudeRad, cosLatitude, sinLatitude, geodeticAngle, refraction, deltaT);
        double[] result = new double[4];

        // declaration of result data
        boolean above = (y_minus > 0.0); // at start of day
        boolean rises = false;
        boolean sets = false;
        double risingHour = Double.NaN;
        double settingHour = Double.NaN;

        // loop over 2-hour-search-intervals applying quadratic interpolation
        do {
            double y_0 =
                sinAlt(mjd0, hour, longitudeRad, cosLatitude, sinLatitude, geodeticAngle, refraction, deltaT);
            double y_plus =
                sinAlt(mjd0, hour + 1, longitudeRad, cosLatitude, sinLatitude, geodeticAngle, refraction, deltaT);
            int count =
                interpolate(y_minus, y_0, y_plus, result);
            if (count == 1) {
                double root = result[2];
                if (Double.isNaN(root)) {
                    root = result[3];
                }
                if (y_minus < 0.0) {
                    risingHour = hour + root;
                    rises = true;
                } else {
                    settingHour = hour + root;
                    sets = true;
                }
            } else if (count == 2) {
                if (result[1] < 0.0) {
                    risingHour = hour + result[3];
                    settingHour = hour + result[2];
                } else {
                    risingHour = hour + result[2];
                    settingHour = hour + result[3];
                }
                rises = true;
                sets = true;
            }
            y_minus = y_plus;
            hour += 2.0;
        } while (!((hour > 25.0) || (rises && sets))); // (> 25.0)-condition cares about possible 25-h-day (end-of-DST)

        // evaluate moonrise and moonset
        Moment rising = null;
        Moment setting = null;

        if (rises) {
            rising = add(start, risingHour);
            if (!rising.toZonalTimestamp(this.observerZoneID).getCalendarDate().equals(d)) {
                rising = null;
                // rises = false;
            }
        }
        if (sets) {
            setting = add(start, settingHour);
            if (!setting.toZonalTimestamp(this.observerZoneID).getCalendarDate().equals(d)) {
                setting = null;
                // sets = false;
            }
        }

        return new Moonlight(d, this.observerZoneID, rising, setting, above);

    }