本文整理汇总了C++中DayTime::setLocalTime方法的典型用法代码示例。如果您正苦于以下问题:C++ DayTime::setLocalTime方法的具体用法?C++ DayTime::setLocalTime怎么用?C++ DayTime::setLocalTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DayTime
的用法示例。
在下文中一共展示了DayTime::setLocalTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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()
示例2: reallyPutRecord
void RinexNavHeader::reallyPutRecord(FFStream& ffs) const
throw(std::exception, FFStreamError, StringException)
{
RinexNavStream& strm = dynamic_cast<RinexNavStream&>(ffs);
strm.header = (*this);
unsigned long allValid;
if (version == 2.0) allValid = allValid20;
else if (version == 2.1) allValid = allValid21;
else if (version == 2.11) allValid = allValid211;
else
{
FFStreamError err("Unknown RINEX version: " + asString(version,3));
err.addText("Make sure to set the version correctly.");
GPSTK_THROW(err);
}
if ((valid & allValid) != allValid)
{
FFStreamError err("Incomplete or invalid header.");
err.addText("Make sure you set all header valid bits for all of the available data.");
GPSTK_THROW(err);
}
string line;
if (valid & versionValid)
{
line = rightJustify(asString(version,3), 10);
line += string(10, ' ');
line += string("NAVIGATION"); //leftJustify(fileType, 20);
line += string(30, ' ');
line += versionString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & runByValid)
{
line = leftJustify(fileProgram,20);
line += leftJustify(fileAgency,20);
DayTime dt;
dt.setLocalTime();
string dat = dt.printf("%02m/%02d/%04Y %02H:%02M:%02S");
line += leftJustify(dat, 20);
line += runByString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & commentValid)
{
vector<string>::const_iterator itr = commentList.begin();
while (itr != commentList.end())
{
line = leftJustify((*itr), 60);
line += commentString;
strm << line << endl;
strm.lineNumber++;
itr++;
}
}
if (valid & ionAlphaValid)
{
line = string(2, ' ');
for (int i = 0; i < 4; i++)
{
line += rightJustify(doub2for(ionAlpha[i], 12, 2),12); // should be 12.4
}
line += string(10, ' ');
line += ionAlphaString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & ionBetaValid)
{
line = string(2, ' ');
for (int i = 0; i < 4; i++)
{
line += rightJustify(doub2for(ionBeta[i], 12, 2),12);
}
line += string(10, ' ');
line += ionBetaString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & deltaUTCValid)
{
line = string(3, ' ');
//line += string(2, ' ');
line += doub2for(A0, 19, 2);
line += doub2for(A1, 19, 2);
line += rightJustify(asString(UTCRefTime),9);
line += rightJustify(asString(UTCRefWeek),9);
line += string(1, ' ');
line += deltaUTCString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & leapSecondsValid)
{
//.........这里部分代码省略.........
示例3: reallyPutRecord
void RinexMetHeader::reallyPutRecord(FFStream& ffs) const
throw(std::exception, FFStreamError,
gpstk::StringUtils::StringException)
{
RinexMetStream& strm = dynamic_cast<RinexMetStream&>(ffs);
// since they want to output this header, let's store
// it internally for use by the data
strm.header = (*this);
// i'm casting out const here to set the correct required valid bits.
// deal with it =P
unsigned long allValid;
if (version == 2.0) allValid = allValid20;
else if (version == 2.1) allValid = allValid21;
else
{
FFStreamError err("Unknown RINEX version: " + asString(version,2));
err.addText("Make sure to set the version correctly.");
GPSTK_THROW(err);
}
if ((valid & allValid) != allValid)
{
string errstr("Incomplete or invalid header: missing: ");
errstr += bitString(allValid & ~valid);
FFStreamError err(errstr);
err.addText("Make sure you set all header valid bits for all of the available data.");
GPSTK_THROW(err);
}
string line;
// line by line, let's do this.
if (valid & versionValid)
{
line = rightJustify(asString(version,2), 9);
line += string(11, ' ');
line += leftJustify(fileType, 40);
line += versionString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & runByValid)
{
line = leftJustify(fileProgram,20);
line += leftJustify(fileAgency,20);
DayTime dt;
dt.setLocalTime();
string dat = dt.printf("%02m/%02d/%04Y %02H:%02M:%02S");
line += leftJustify(dat, 20);
line += runByString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & commentValid)
{
vector<string>::const_iterator itr = commentList.begin();
while (itr != commentList.end())
{
line = leftJustify((*itr), 60);
line += commentString;
strm << line << endl;
strm.lineNumber++;
itr++;
}
}
if (valid & markerNameValid)
{
line = leftJustify(markerName, 60);
line += markerNameString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & markerNumberValid)
{
line = leftJustify(markerNumber, 60);
line += markerNumberString;
strm << line << endl;
strm.lineNumber++;
}
if (valid & obsTypeValid)
{
line = rightJustify(asString(obsTypeList.size()),6);
vector<RinexMetType>::const_iterator itr = obsTypeList.begin();
size_t numWritten = 0;
while (itr != obsTypeList.end())
{
numWritten++;
// stupid continuation lines =P
if ((numWritten % (maxObsPerLine+1)) == 0)
{
line += obsTypeString;
strm << line << endl;
strm.lineNumber++;
line = string(6,' ');
}
line += rightJustify(convertObsType(*itr), 6);
itr++;
//.........这里部分代码省略.........