Changeset 18444


Ignore:
Timestamp:
02/17/16 14:03:04 (9 years ago)
Author:
tbretz
Message:
Fixed the problem with rounding to full minutes in the output.
File:
1 edited

Legend:

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

    r18443 r18444  
    195195    bool IsRangeValid(const double &jd_begin, const double &jd_end) const
    196196    {
    197         const double step = 1./24/60;
    198         for (double jd=jd_begin; jd<jd_end+step/2; jd++)
    199             if (!valid(SolarObjects(jd)))
     197        const uint32_t n = nearbyint((jd_end-jd_begin)*24*60);
     198        for (uint32_t i=0; i<n; i++)
     199            if (!valid(SolarObjects(jd_begin+i/24./60.)))
    200200                return false;
    201201
     
    390390        if (intersection<0)
    391391        {
    392             const double step = 1./24/60;
    393             for (double jd=obs[i].begin; jd<obs[i].end-step/2; jd+=step)
     392            const uint32_t n = nearbyint((obs[i].end-obs[i].begin)*24*60);
     393            for (uint32_t ii=0; ii<n; ii++)
    394394            {
     395                const double jd = obs[i].begin+ii/24./60.;
     396
    395397                const SolarObjects so(jd);
    396398                if (obs[i-1].getThreshold(so)>=obs[i+1].getThreshold(so))
     
    508510    {
    509511        string tm = Time(src.begin).GetAsStr();
    510 
    511512        if (src.preobs.size()>0)
    512513        {
     
    640641    const RstTime sun_rise = GetSolarRst(floor(time.JD())+0.5, angle_sun_rise);
    641642
    642     const double sunset  = ceil(sun_set.set*24*60)/24/60;
    643     const double sunrise = floor(sun_rise.rise*24*60)/24/60;
     643    const double sunset  = ceil(sun_set.set*24*60)   /24/60 + 1e-9;
     644    const double sunrise = floor(sun_rise.rise*24*60)/24/60 + 1e-9;
    644645
    645646    cout << "\n";
    646     cout << "Date: " << Time(floor(sunset)) << "\n";
    647     cout << "Set:  " << Time(sun_set.set)   << "\n";
    648     cout << "Rise: " << Time(sun_rise.rise) << "\n";
     647    cout << "Date: " << Time(floor(sunset)).GetAsStr() << "\n";
     648    cout << "Set:  " << Time(sunset).GetAsStr()  << "  [" << Time(sun_set.set)   << "]\n";
     649    cout << "Rise: " << Time(sunrise).GetAsStr() << "  [" << Time(sun_rise.rise) << "]\n";
    649650    cout << endl;
    650651
     
    709710    vector<Source> obs;
    710711
    711     const double step = 1./24/60;
    712     for (double jd=sunset; jd<sunrise-step/2; jd+=step)
    713     {
     712    const uint32_t n = nearbyint((sunrise-sunset)*24*60);
     713    for (uint32_t i=0; i<n; i++)
     714    {
     715        const double jd = sunset + i/24./60.;
     716
    714717        const SolarObjects so(jd);
    715718
Note: See TracChangeset for help on using the changeset viewer.