Ignore:
Timestamp:
03/30/13 16:39:48 (12 years ago)
Author:
tbretz
Message:
Make use of the new GetNextSunRise() function of the Time-class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/drivectrl.cc

    r15100 r15206  
    11251125    Time fSunRise;
    11261126
    1127     Time GetSunRise(const Time &time=Time())
    1128     {
    1129 #ifdef HAVE_LIBNOVA
    1130         const double lon = -(17.+53./60+26.525/3600);
    1131         const double lat =   28.+45./60+42.462/3600;
    1132 
    1133         ln_lnlat_posn observer;
    1134         observer.lng = lon;
    1135         observer.lat = lat;
    1136 
    1137         // This caluclates the sun-rise of the next day after 12:00 noon
    1138         ln_rst_time sun_day;
    1139         if (ln_get_solar_rst(time.JD(), &observer, &sun_day)==1)
    1140         {
    1141             T::Fatal("GetSunRise reported the sun to be circumpolar!");
    1142             return Time(Time::none);
    1143         }
    1144 
    1145         if (Time(sun_day.rise)>=time)
    1146             return Time(sun_day.rise);
    1147 
    1148         if (ln_get_solar_rst(time.JD()+0.5, &observer, &sun_day)==1)
    1149         {
    1150             T::Fatal("GetSunRise reported the sun to be circumpolar!");
    1151             return Time(Time::none);
    1152         }
    1153 
    1154         return Time(sun_day.rise);
    1155 #else
    1156         return Time(boost::date_time::pos_infin);
    1157 #endif
    1158     }
    1159 
    11601127    int ShiftSunRise()
    11611128    {
    11621129        const Time sunrise = fSunRise;
    11631130
    1164         fSunRise = GetSunRise(Time());
    1165         if (!fSunRise)
    1166             return T::kSM_FatalError;
     1131        fSunRise = Time().GetNextSunRise();
    11671132
    11681133        if (sunrise==fSunRise)
     
    12191184    StateMachineDrive(ostream &out=cout) :
    12201185        T(out, "DRIVE_CONTROL"), ba::io_service::work(static_cast<ba::io_service&>(*this)),
    1221         fDrive(*this, *this), fAutoResume(false), fSunRise(GetSunRise())
     1186        fDrive(*this, *this), fAutoResume(false), fSunRise(Time().GetNextSunRise())
    12221187    {
    12231188        // State names
Note: See TracChangeset for help on using the changeset viewer.