当前位置: 首页>>代码示例>>C++>>正文


C++ DayTime类代码示例

本文整理汇总了C++中DayTime的典型用法代码示例。如果您正苦于以下问题:C++ DayTime类的具体用法?C++ DayTime怎么用?C++ DayTime使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了DayTime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getSerialNumber

 static int getSerialNumber(int mjd)
    throw(DayTime::DayTimeException)
    {
       DayTime t;
       t.setMJD(double(mjd));
       return getSerialNumber(t);
    }
开发者ID:ianmartin,项目名称:GPSTk,代码行数:7,代码来源:EarthOrientation.hpp

示例2: GMST

//------------------------------------------------------------------------------------
double GMST(DayTime t)
{
try {
      // days' since epoch = +/-(integer+0.5)
   double days = t.JD() - 2451545;
   int d=int(days);
   if(d < 0 && days==double(d)) d++;
   days = d + (days<0.0 ? -0.5 : 0.5);
   double Tp = days/36525.0;

      // Compute GMST
   double G;
   //G = 24060.0 + 50.54841 + 8640184.812866*Tp;  // seconds (24060s = 6h 41min)
   //G /= 86400.0; // instead, divide the above equation by 86400.0 manually...
   G = 0.27847222 + 0.00058505104167 + 100.0021390378009*Tp;
   G += (0.093104 - 6.2e-6*Tp)*Tp*Tp/86400.0;      // seconds/86400 = circles
   double r=1.002737909350795 + (5.9006e-11 - 5.9e-15*Tp)*Tp;
   G += r*t.secOfDay()/86400.0;                   // circles
   G *= 360.0;                                    // degrees
   //G = fmod(G,360.0);
   //if(G < -180.0) G += 360.0;
   //if(G >  180.0) G -= 360.0;

   return G;
}
catch(Exception& e) { GPSTK_RETHROW(e); }
catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }
catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:30,代码来源:PhaseWindup.cpp

示例3:

MPSim::~MPSim()
{
   DayTime endTime;
   logStream << "Execution end at: " << endTime.printf(epochFormat) << endl;
   logStream << "Total execution time: " << endTime - startTime << " seconds" 
	     << endl;
}
开发者ID:ianmartin,项目名称:GPSTk,代码行数:7,代码来源:mpsim.cpp

示例4: checkArguments

   string CommandOptionWithTimeArg :: checkArguments()
   {
      string errstr = CommandOptionWithAnyArg::checkArguments();

      if (errstr != string())
         return errstr;

      vector<string>::size_type vecindex;
      for(vecindex = 0; vecindex < value.size(); vecindex++)
      {
         string thisTimeSpec = getTimeSpec(vecindex);
         if (thisTimeSpec != string())
         {
            try {
               DayTime dt;
               dt.setToString(value[vecindex], thisTimeSpec);
               times.push_back(dt);
            }
            catch (...)
            {
               errstr += "\"" + value[vecindex] + "\" is not a valid time.";
            }
         }
         else
            errstr += "\"" + value[vecindex] + "\" is not a valid time.";
      }

      return errstr;
   }
开发者ID:ianmartin,项目名称:GPSTk,代码行数:29,代码来源:CommandOptionWithTimeArg.cpp

示例5: FinishUp

void xINCDayTime :: FinishUp (void)
{
	gpstk::DayTime dtorig(2000,12,1,0,0,0.);
	DayTime endTime;
        cout << endl << setprecision(4);
   	cout << endTime.printf("Completed on %B %d, %Y %H:%02M:%02S") << endl;
      	cout << "Processing time " << endTime-startTime << " seconds." << endl;
      	cout << endl;
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:9,代码来源:xDayTimeInc.cpp

示例6: main

//------------------------------------------------------------------------------------
int main(int argc, char **argv)
{
try {
   totaltime = clock();
   int iret,nfile,reading,nread;

      // Title and description
   Title = PrgmName + ", part of the GPS ToolKit, Ver " + PrgmVers + ", Run ";
   PrgmEpoch.setLocalTime();
   Title += PrgmEpoch.printf("%04Y/%02m/%02d %02H:%02M:%02S");
   Title += "\n";
   cout << Title;

      // get command line
   iret=GetCommandLine(argc, argv);
   if(iret) return iret;

   PrevEpoch = DayTime::BEGINNING_OF_TIME;

   // loop over input files - reading them twice
   Ninterps = 0;
   for(reading=1; reading <= 2; reading++) {
      nread = 0;
      for(nfile=0; nfile<PIC.InputObsName.size(); nfile++) {
         iret = ReadFile(nfile,reading);
         if(iret < 0) break;
         nread++;
      }
      // quit if error
      if(iret < 0) break;

      if(nread>0) {
         iret = AfterReadingFiles(reading);
         if(iret < 0) break;
      }

      CurrEpoch = DayTime::BEGINNING_OF_TIME;
   }

   PIC.oflog << PrgmName << " did " << Ninterps << " interpolations" << endl;
   totaltime = clock()-totaltime;
   PIC.oflog << PrgmName << " timing: " << fixed << setprecision(3)
      << double(totaltime)/double(CLOCKS_PER_SEC) << " seconds.\n";
   cout << PrgmName << " timing: " << fixed << setprecision(3)
      << double(totaltime)/double(CLOCKS_PER_SEC) << " seconds.\n";

   PIC.oflog.close();

   return iret;
}
catch(FFStreamError& e) { cout << "FFStream exception:\n" << e << endl; }
catch(Exception& e) { cout << "GPSTK exception:\n" << e << endl; }
catch (...) { cout << "Unknown exception in main." << endl; }
}   // end main()
开发者ID:loongfee,项目名称:ossim-svn,代码行数:55,代码来源:posInterp.cpp

示例7: main

/// returns 0 if all tests pass
int main()
{
   using gpstk::DayTime;
   
   try
   {
      cout << "BOT:" << DayTime(gpstk::DayTime::BEGINNING_OF_TIME) << endl;
      cout << "EOT:" << DayTime(gpstk::DayTime::END_OF_TIME) << endl;
     
      DayTime dt;
      dt.setSystemTime();
      cout << "Check that the output matches the current UTC time." << endl
           << "string                         printf()" << endl;

      dtft(cout, dt, "mjd:  %Q (%.0Q)");
      dtft(cout, dt, "mjd:  %5.3Q");
      dtft(cout, dt, "mdy:  %02m/%02d/%04Y");
      dtft(cout, dt, "hms:  %02H:%02M:%02S");
      dtft(cout, dt, "hms:  %02H:%02M:%06.3f");
      dtft(cout, dt, "cal:  %A, %B %d, %Y");
      dtft(cout, dt, "week: %F(%G)");
      dtft(cout, dt, "sow:  %g");
      dtft(cout, dt, "sow:  %06.3g");
      dtft(cout, dt, "doy:  %j:%s");
      dtft(cout, dt, "dow:  %w");
      dtft(cout, dt, "z:    %Z (%z)");
      dtft(cout, dt, "unix: %U.%06u");

      cout << endl
           << "The following functions use DayTime::setToString()" << endl;

      string format = "%02m/%02d/%04Y %02H:%02M:%02S";
      string st = dt.printf(format);

      DayTime q;
      q.setToString(st, format);
      dtft(cout, q, format);

      cout << "Tests complete." << endl;
      return 0;
   }
   catch(gpstk::Exception& e)
   {
      cout << e << endl;
   }
   catch(...)
   {
      cout << "Some other exception thrown..." << endl;
   }

   cout << "Exiting with exceptions." << endl;
   return -1;
}
开发者ID:ianmartin,项目名称:GPSTk,代码行数:54,代码来源:daytimetest.cpp

示例8: OutputClockData

//------------------------------------------------------------------------------------
int OutputClockData(void) throw(Exception)
{
try {
   if(CI.Verbose) oflog << "BEGIN OutputClockData()" << endl;

   if(CI.OutputClkFile.empty()) return 0;

   int i;
   DayTime tt;
   map<string,Station>::const_iterator it;
   format f166(16,6),f92(9,2,2),f96(9,6);

      // open an output file for Clk data
   ofstream clkofs;
   clkofs.open(CI.OutputClkFile.c_str(),ios::out);
   if(clkofs.is_open()) {
      oflog << "Opened file " << CI.OutputClkFile << " for DD data output." << endl;
      clkofs << "# " << Title << endl;
      clkofs << "CLK site week  sec_wk   Rx_clk_bias(m)   Sig(m)   TT_off(s)\n";
   }
   else {
      // TD error msg
      return -1;
   }


      // loop over stations
   for(it=Stations.begin(); it != Stations.end(); it++) {

         // loop over epochs
      for(i=0; i<it->second.ClockBuffer.size(); i++) {

         tt = FirstEpoch + it->second.CountBuffer[i]*CI.DataInterval;

         clkofs << "CLK " << it->first << " " << tt.printf("%4F %10.3g")
            << " " << f166 << it->second.ClockBuffer[i]
            << " " << f92 << it->second.ClkSigBuffer[i]
            // TD add clock polynomial Evaluate(tt)
            << " " << f92 << it->second.RxTimeOffset[i]
            << endl;

      }  // loop over epochs

   }  // loop over stations
   
   clkofs.close();

   return 0;
}
catch(Exception& e) { GPSTK_RETHROW(e); }
catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }
catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }
}   // end OutputClockData()
开发者ID:ianmartin,项目名称:GPSTk,代码行数:54,代码来源:DataOutput.cpp

示例9: getNewTime

void NavSum::getNewTime(DayTime& dt)
{
   short week = -1;
   double SOW;
   string buf;
   short done = 0;
   
   while (!done)
   {
      cout << " Enter full GPS week: ";
      getline(cin, buf);
      istringstream instr(buf);
      instr >> week;
      if (week != -1)
         done = 1;
      else 
         cout << " Error entering week.  Please try again." << endl;
   }
   
      // Now reset flag and get SOW
   done = 0;
   while (!done)
   {
      cout << " Enter GPS seconds of week: ";
      getline(cin,buf);
      istringstream instr(buf);
      instr >> SOW;
      if ((SOW >= 0.0L) && (SOW < 604800.0L) )
         done = 1;
      else 
         cout << " Error entering SOW.  Please try again." << endl;
   }
   dt.setGPSfullweek(week, SOW);
}
开发者ID:jehc,项目名称:ossim-svn,代码行数:34,代码来源:navsum.cpp

示例10: updateFileName

      // Update the file name, returns true if the file name changed
      bool updateFileName(const DayTime& t=DayTime())
      {
         bool openedNewFile = false;
         const std::string newFilename=t.printf(filespec);
         if (currentFilename.size() == 0 && newFilename.size() > 0)
         {
            currentFilename = newFilename;
            currentTime = t;
            BaseStream::open(currentFilename.c_str(), omode);
            if (debugLevel)
               std::cout << "Opened " << currentFilename << std::endl;
            openedNewFile=true;
         }
         else if (newFilename == currentFilename)
         {
            currentTime = t;
            openedNewFile=false;
         }
         else
         {
            if (debugLevel)
               std::cout << "Closing " << currentFilename << std::endl;
            BaseStream::close();
            currentFilename = newFilename;
            currentTime = t;
            BaseStream::open(currentFilename.c_str(), omode);
            if (debugLevel)
               std::cout << "Opened " << currentFilename << std::endl;
            openedNewFile=true;
         }

         return openedNewFile;
      };
开发者ID:ianmartin,项目名称:GPSTk,代码行数:34,代码来源:TimeNamedFileStream.hpp

示例11: testRandomAccessors

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;
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:42,代码来源:DayTimeConversionTest.cpp

示例12: throw

ConstellationDefinition ConstellationSet::findCD( const gpstk::DayTime dt ) const
         throw(NoConstellationFound)
{
   DayTime localDT = dt;
   localDT.setSecOfDay(  (DayTime::SEC_DAY/2) );   // Set to noon to match CDs
   
      // Best case (hopefully nominal) is that there is a definition
      // available for the date in question.
   CI ci = cdMap.find(localDT);
   //cout << "Found in map: " << ci->first << endl;
   if (ci==cdMap.end())
   {
         // If no, first check to see whether date in question is later
         // than any date available.
      if (localDT>getLatestDate())
      {
         ConstellationSet::NoConstellationFound exc("All Constellation Definitions Too Early");
         GPSTK_THROW(exc);
      }
      
         // If not, start at the day of interest and back up until we
         // find a definition or hit the earliest definition
      bool done = false;
      localDT -= DayTime::SEC_DAY;
      while (!done && localDT > getEarliestDate() )
      {
         ci = cdMap.find(localDT);
         if (ci!=cdMap.end()) done = true;
         localDT -= DayTime::SEC_DAY;
      }
         // Did not find one before reaching the "head" of the list
      if (!done)
      {
         ConstellationSet::NoConstellationFound exc("All Constellation Definitions Too Late");
         GPSTK_THROW(exc);   
      }
   }

   ConstellationDefinition cd = ci->second;
   return(cd);
}
开发者ID:ianmartin,项目名称:GPSTk,代码行数:41,代码来源:ConstellationSet.cpp

示例13: main

int main(int argc, char* argv[])
{

   try {
      
      DayTime time;

      cout << "Hello world!" << endl;
      cout << "   The current GPS week is " << time.GPSfullweek() << endl;
      cout << "   The day of the GPS week is " << time.GPSday() << endl;
      cout << "   The seconds of the GPS week is " << time.GPSsecond() << endl;

   }
   catch( Exception error)
   {
      cout << error << endl;
      exit(-1);
   }

   exit(0);
}
开发者ID:ianmartin,项目名称:GPSTk,代码行数:21,代码来源:example1.cpp

示例14: SolarPosition

//------------------------------------------------------------------------------------
// Solar ephemeris, in ECEF coordinates.
// Accuracy is about 1 arcminute, when t is within 2 centuries of 2000.
// Ref. Astronomical Almanac pg C24, as presented on USNO web site.
// input
//    t             epoch of interest
// output
//    lat,lon,R     latitude, longitude and distance (deg,deg,m in ECEF) of sun at t.
//    AR            apparent angular radius of sun as seen at Earth (deg) at t.
void SolarPosition(DayTime t, double& lat, double& lon, double& R, double& AR)
{
try {
   //const double mPerAU = 149598.0e6;
   double D;     // days since J2000
   double g,q;
   double L;     // sun's geocentric apparent ecliptic longitude (deg)
   //double b=0; // sun's geocentric apparent ecliptic latitude (deg)
   double e;     // mean obliquity of the ecliptic (deg)
   //double R;   // sun's distance from Earth (m)
   double RA;    // sun's right ascension (deg)
   double DEC;   // sun's declination (deg)
   //double AR;  // sun's apparent angular radius as seen at Earth (deg)

   D = t.JD() - 2451545.0;
   g = (357.529 + 0.98560028 * D) * DEG_TO_RAD;
   q = 280.459 + 0.98564736 * D;
   L = (q + 1.915 * ::sin(g) + 0.020 * ::sin(2*g)) * DEG_TO_RAD;

   e = (23.439 - 0.00000036 * D) * DEG_TO_RAD;
   RA = atan2(::cos(e)*::sin(L),::cos(L)) * RAD_TO_DEG;
   DEC = ::asin(::sin(e)*::sin(L)) * RAD_TO_DEG;

   //equation of time = apparent solar time minus mean solar time
   //= [q-RA (deg)]/(15deg/hr)

   // compute the hour angle of the vernal equinox = GMST and convert RA to lon
   lon = fmod(RA-GMST(t),360.0);
   if(lon < -180.0) lon += 360.0;
   if(lon >  180.0) lon -= 360.0;

   lat = DEC;

   // ECEF unit vector in direction Earth to sun
   //xhat = ::cos(lat*DEG_TO_RAD)*::cos(lon*DEG_TO_RAD);
   //yhat = ::cos(lat*DEG_TO_RAD)*::sin(lon*DEG_TO_RAD);
   //zhat = ::sin(lat*DEG_TO_RAD);

   // R in AU
   R = 1.00014 - 0.01671 * ::cos(g) - 0.00014 * ::cos(2*g);
   // apparent angular radius in degrees
   AR = 0.2666/R;
   // convert to meters
   R *= 149598.0e6;
}
catch(Exception& e) { GPSTK_RETHROW(e); }
catch(exception& e) { Exception E("std except: "+string(e.what())); GPSTK_THROW(E); }
catch(...) { Exception e("Unknown exception"); GPSTK_THROW(e); }
}
开发者ID:loongfee,项目名称:ossim-svn,代码行数:58,代码来源:PhaseWindup.cpp

示例15: gx

 ObsRngDev::ObsRngDev(
    const double prange,
    const SatID& svid,
    const DayTime& time,
    const ECEF& rxpos,
    const XvtStore<SatID>& eph,
    GeoidModel& gm,
    bool svTime)
    : obstime(time), svid(svid), ord(0), wonky(false)
 {
    computeOrd(prange, rxpos, eph, gm, svTime);
    Geodetic gx(rxpos, &gm);
    NBTropModel nb(gx.getAltitude(), gx.getLatitude(), time.DOYday());
    computeTrop(nb);
 }
开发者ID:ianmartin,项目名称:GPSTk,代码行数:15,代码来源:ObsRngDev.cpp


注:本文中的DayTime类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。