Exemplo n.º 1
0
bool testRandomAccessors(DayTime &dtb, DayTime &dte, long ndates)
{
   bool cumulativeResult=true;

      // Seed the random number generator
   gpstk::DayTime dt;
   unsigned int seed= (unsigned int) dt.GPSsow();
   srand(seed);

   unsigned long dayDiff = (unsigned long) 
                           ceil(dte.MJD() - dtb.MJD());
   
   for (int j=0;j<ndates;++j) // Loop through set of random days
   { 
      double dayDelta = floor( rand()*1./ RAND_MAX * dayDiff);
      double sodDelta = rand()*1./RAND_MAX;
      gpstk::DayTime testDate;

      testDate.setMJD(dtb.MJD()+dayDelta+sodDelta);
         
      short year =     testDate.year();
      short month =    testDate.month();
      short dom =      testDate.day();
      short hour =     testDate.hour();
      short minute =   testDate.minute();
      double seconds = testDate.second();
      short doy =      testDate.DOY();
      double sod =     testDate.DOYsecond();
      short week =     testDate.GPSfullweek()%1024; 
      double sow =     testDate.GPSsow();
      long zcount =    testDate.GPSzcount();
      short hintYear = testDate.year();
      double MJD =     testDate.MJD();
      cumulativeResult = cumulativeResult &&
         testMutators( year, month, dom, hour, minute, seconds,
                       doy, sod,
                       week, sow, zcount, hintYear,
                       MJD );
      } // End loop over random dates
   
   return cumulativeResult;
}
Exemplo n.º 2
0
 /** Edit the store by deleting all entries before(after)
  *  the given min(max) times. If tmin is later than tmax,
  *  the two times are switched.
  *  @param tmin DayTime desired earliest store time.
  *  @param tmax DayTime desired latest store time.
  */
 void edit(const DayTime& tmin,
           const DayTime& tmax)
    throw()
    { edit(int(tmin.MJD()+0.5),int(tmax.MJD()+1.5)); }