Logo Search packages:      
Sourcecode: icu version File versions  Download package

Returns the time (GMT) of sunrise or sunset on the local date to which this calendar is currently set.

NOTE: This method only works well if this object is set to a time near local noon. Because of variations between the local official time zone and the geographic longitude, the computation can flop over into an adjacent day if this object is set to a time near local midnight.

Definition at line 744 of file astro.cpp.

References ClockMath::floorDivide(), fTime, and setTime().

    UDate t0 = fTime;

    // Make a rough guess: 6am or 6pm local time on the current day
    double noon = ClockMath::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS);

    U_DEBUG_ASTRO_MSG(("Noon=%.2lf, %sL, gmtoff %.2lf\n", noon, debug_astro_date(noon+fGmtOffset), fGmtOffset));
    setTime(noon +  ((rise ? -6 : 6) * HOUR_MS));
    U_DEBUG_ASTRO_MSG(("added %.2lf ms as a guess,\n", ((rise ? -6. : 6.) * HOUR_MS)));

    RiseSetCoordFunc func;
    double t = riseOrSet(func,
                         .533 * DEG_RAD,        // Angular Diameter
                         34. /60.0 * DEG_RAD,    // Refraction correction
                         MINUTE_MS / 12.);       // Desired accuracy

    return t;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index