1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-28 08:02:58 +00:00

Clean code

This commit is contained in:
Carles Fernandez 2016-10-30 10:20:34 +01:00
parent 2ddc78992f
commit 0e10be6534

View File

@ -182,7 +182,6 @@ Rinex_Printer::Rinex_Printer()
} }
Rinex_Printer::~Rinex_Printer() Rinex_Printer::~Rinex_Printer()
{ {
// close RINEX files // close RINEX files
@ -609,7 +608,6 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_CNAV_Iono & io
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- End of Header // -------- End of Header
line.clear(); line.clear();
line += std::string(60, ' '); line += std::string(60, ' ');
@ -801,135 +799,135 @@ void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& iono, co
void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac) void Rinex_Printer::rinex_nav_header(std::fstream& out, const Gps_Iono& gps_iono, const Gps_Utc_Model& gps_utc_model, const Galileo_Iono& galileo_iono, const Galileo_Utc_Model& galileo_utc_model, const Galileo_Almanac& galileo_almanac)
{ {
std::string line; std::string line;
stringVersion = "3.02"; stringVersion = "3.02";
version = 3; version = 3;
// -------- Line 1 // -------- Line 1
line = std::string(5, ' '); line = std::string(5, ' ');
line += stringVersion; line += stringVersion;
line += std::string(11, ' '); line += std::string(11, ' ');
line += std::string("N: GNSS NAV DATA"); line += std::string("N: GNSS NAV DATA");
line += std::string(4, ' '); line += std::string(4, ' ');
line += std::string("M: MIXED"); line += std::string("M: MIXED");
line += std::string(12, ' '); line += std::string(12, ' ');
line += std::string("RINEX VERSION / TYPE"); line += std::string("RINEX VERSION / TYPE");
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line 2 // -------- Line 2
line.clear(); line.clear();
line += Rinex_Printer::getLocalTime(); line += Rinex_Printer::getLocalTime();
line += std::string("PGM / RUN BY / DATE"); line += std::string("PGM / RUN BY / DATE");
line += std::string(1, ' '); line += std::string(1, ' ');
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line COMMENT // -------- Line COMMENT
line.clear(); line.clear();
line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60); line += Rinex_Printer::leftJustify("GNSS NAVIGATION MESSAGE FILE GENERATED BY GNSS-SDR", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20); line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line COMMENT // -------- Line COMMENT
line.clear(); line.clear();
std::string gnss_sdr_version(GNSS_SDR_VERSION); std::string gnss_sdr_version(GNSS_SDR_VERSION);
line += "GNSS-SDR VERSION "; line += "GNSS-SDR VERSION ";
line += Rinex_Printer::leftJustify(gnss_sdr_version, 43); line += Rinex_Printer::leftJustify(gnss_sdr_version, 43);
line += Rinex_Printer::leftJustify("COMMENT", 20); line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line COMMENT // -------- Line COMMENT
line.clear(); line.clear();
line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60); line += Rinex_Printer::leftJustify("See http://gnss-sdr.org", 60);
line += Rinex_Printer::leftJustify("COMMENT", 20); line += Rinex_Printer::leftJustify("COMMENT", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line ionospheric info 1 // -------- Line ionospheric info 1
line.clear(); line.clear();
line += std::string("GAL "); line += std::string("GAL ");
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai0_5, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai0_5, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai1_5, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai1_5, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai2_5, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_iono.ai2_5, 10, 2), 12);
double zero = 0.0; double zero = 0.0;
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(zero, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(zero, 10, 2), 12);
line += std::string(7, ' '); line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20); line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line ionospheric info 2 // -------- Line ionospheric info 2
line.clear(); line.clear();
line += std::string("GPSA"); line += std::string("GPSA");
line += std::string(1, ' '); line += std::string(1, ' ');
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha0, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha0, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha1, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha1, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha2, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha2, 10, 2), 12);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha3, 10, 2), 12); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_iono.d_alpha3, 10, 2), 12);
line += std::string(7, ' '); line += std::string(7, ' ');
line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20); line += Rinex_Printer::leftJustify("IONOSPHERIC CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line system time correction // -------- Line system time correction
line.clear(); line.clear();
line += std::string("GAUT"); line += std::string("GAUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A0_6, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A0_6, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A1_6, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_utc_model.A1_6, 15, 2), 16);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.t0t_6), 7); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.t0t_6), 7);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.WNot_6), 5); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_utc_model.WNot_6), 5);
line += std::string(10, ' '); line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line system time correction 2 // -------- Line system time correction 2
line.clear(); line.clear();
line += std::string("GPGA"); line += std::string("GPGA");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_0G_10, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(galileo_almanac.A_1G_10, 15, 2), 16);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.t_0G_10), 7);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(galileo_almanac.WN_0G_10), 5);
line += std::string(10, ' '); line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line system time correction 3 // -------- Line system time correction 3
line.clear(); line.clear();
line += std::string("GPUT"); line += std::string("GPUT");
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A0, 16, 2), 18);
line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16); line += Rinex_Printer::rightJustify(Rinex_Printer::doub2for(gps_utc_model.d_A1, 15, 2), 16);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_t_OT), 7); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_t_OT), 7);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019 line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_WN_T + 1024), 5); // valid until 2019
line += std::string(10, ' '); line += std::string(10, ' ');
line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20); line += Rinex_Printer::leftJustify("TIME SYSTEM CORR", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- Line 6 leap seconds // -------- Line 6 leap seconds
// For leap second information, see http://www.endruntechnologies.com/leap.htm // For leap second information, see http://www.endruntechnologies.com/leap.htm
line.clear(); line.clear();
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_DeltaT_LS), 6); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_DeltaT_LS), 6);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_DeltaT_LSF), 6); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.d_DeltaT_LSF), 6);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_WN_LSF), 6); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_WN_LSF), 6);
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_DN), 6); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(gps_utc_model.i_DN), 6);
line += std::string(36, ' '); line += std::string(36, ' ');
line += Rinex_Printer::leftJustify("LEAP SECONDS", 20); line += Rinex_Printer::leftJustify("LEAP SECONDS", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- End of Header // -------- End of Header
line.clear(); line.clear();
line += std::string(60, ' '); line += std::string(60, ' ');
line += Rinex_Printer::leftJustify("END OF HEADER", 20); line += Rinex_Printer::leftJustify("END OF HEADER", 20);
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
} }
@ -2329,7 +2327,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
if (version==2) if (version == 2)
{ {
// --------- WAVELENGHT FACTOR // --------- WAVELENGHT FACTOR
// put here real data! // put here real data!
@ -2342,7 +2340,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
out << line << std::endl; out << line << std::endl;
} }
if (version==3) if (version == 3)
{ {
// -------- SYS / OBS TYPES // -------- SYS / OBS TYPES
// one line per available system // one line per available system
@ -2377,7 +2375,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
out << line << std::endl; out << line << std::endl;
} }
if (version==2) if (version == 2)
{ {
// -------- SYS / OBS TYPES // -------- SYS / OBS TYPES
line.clear(); line.clear();
@ -2403,7 +2401,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream& out, const Gps_Ephemeris& eph
out << line << std::endl; out << line << std::endl;
} }
if (version==3) if (version == 3)
{ {
// -------- Signal Strength units // -------- Signal Strength units
line.clear(); line.clear();
@ -2623,7 +2621,6 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_CNAV_Ephemeri
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- TIME OF FIRST OBS // -------- TIME OF FIRST OBS
line.clear(); line.clear();
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation); boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation);
@ -2660,6 +2657,7 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_CNAV_Ephemeri
void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, const double d_TOW_first_observation) void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, const double d_TOW_first_observation)
{ {
if(eph_cnav.d_i_0){} // avoid warning, not needed
std::string line; std::string line;
// -------- Line 1 // -------- Line 1
@ -2849,7 +2847,6 @@ void Rinex_Printer::rinex_obs_header(std::fstream & out, const Gps_Ephemeris & e
Rinex_Printer::lengthCheck(line); Rinex_Printer::lengthCheck(line);
out << line << std::endl; out << line << std::endl;
// -------- TIME OF FIRST OBS // -------- TIME OF FIRST OBS
line.clear(); line.clear();
boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation); boost::posix_time::ptime p_gps_time = Rinex_Printer::compute_GPS_time(eph,d_TOW_first_observation);
@ -3813,7 +3810,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_CNAV_Ephemeris
} }
line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3); line += Rinex_Printer::rightJustify(boost::lexical_cast<std::string>(numSatellitesObserved), 3);
// Receiver clock offset (optional) // Receiver clock offset (optional)
//line += rightJustify(asString(clockOffset, 12), 15); //line += rightJustify(asString(clockOffset, 12), 15);
@ -3880,13 +3876,12 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_CNAV_Ephemeris
if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' '); if (lineObs.size() < 80) lineObs += std::string(80 - lineObs.size(), ' ');
out << lineObs << std::endl; out << lineObs << std::endl;
} }
} }
void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges) void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph, const Gps_CNAV_Ephemeris & eph_cnav, double obs_time, const std::map<int, Gnss_Synchro> & pseudoranges)
{ {
if(eph_cnav.d_i_0){} // avoid warning, not needed
// RINEX observations timestamps are GPS timestamps. // RINEX observations timestamps are GPS timestamps.
std::string line; std::string line;
@ -3953,7 +3948,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph
// Get common observables // Get common observables
std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > > common_pseudoranges; std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > > common_pseudoranges;
std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > >::const_iterator common_pseudoranges_iter; std::vector< std::pair< Gnss_Synchro, Gnss_Synchro > >::const_iterator common_pseudoranges_iter;
std::map<int, Gnss_Synchro> pseudorangesL1_with_L2;
for(pseudoranges_iter = pseudorangesL1.begin(); for(pseudoranges_iter = pseudorangesL1.begin();
pseudoranges_iter != pseudorangesL1.end(); pseudoranges_iter != pseudorangesL1.end();
@ -3971,7 +3965,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream & out, const Gps_Ephemeris & eph
Gnss_Synchro pr2 = pseudoranges_iter2->second; Gnss_Synchro pr2 = pseudoranges_iter2->second;
p = std::make_pair(pr1, pr2); p = std::make_pair(pr1, pr2);
common_pseudoranges.push_back(p); common_pseudoranges.push_back(p);
pseudorangesL1_with_L2.insert(std::pair<int, Gnss_Synchro>(pseudoranges_iter->first, pseudoranges_iter->second));
} }
} }
} }
@ -4098,7 +4091,6 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Galileo_Ephemeris& ep
{ {
// RINEX observations timestamps are Galileo timestamps. // RINEX observations timestamps are Galileo timestamps.
// See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html // See http://gage14.upc.es/gLAB/HTML/Observation_Rinex_v3.01.html
std::string line; std::string line;
boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, obs_time); boost::posix_time::ptime p_galileo_time = Rinex_Printer::compute_Galileo_time(eph, obs_time);
@ -4336,11 +4328,10 @@ void Rinex_Printer::log_rinex_obs(std::fstream& out, const Gps_Ephemeris& gps_ep
} }
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds not.
void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second) void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &month, int &day, int &hour, int &minute, int &second)
{ {
// represents GPS time (week, TOW) in the date time format of the Gregorian calendar.
// -> Leap years are considered, but leap seconds are not.
int days_per_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int days_per_month[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// seconds in a not leap year // seconds in a not leap year
@ -4407,7 +4398,6 @@ void Rinex_Printer::to_date_time(int gps_week, int gps_tow, int &year, int &mont
} }
void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_message) void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_message)
{ {
// line 1: PRN / EPOCH / RCVR // line 1: PRN / EPOCH / RCVR
@ -4421,25 +4411,25 @@ void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_mes
int gps_week; int gps_week;
double gps_sec; double gps_sec;
if(sbs_message.get_rx_time_obj().get_gps_time(gps_week, gps_sec)) if(sbs_message.get_rx_time_obj().get_gps_time(gps_week, gps_sec))
{ {
int year; int year;
int month; int month;
int day; int day;
int hour; int hour;
int minute; int minute;
int second; int second;
double gps_sec_one_digit_precicion = round(gps_sec *10)/10; // to prevent rounding towards 60.0sec in the stream output double gps_sec_one_digit_precicion = round(gps_sec *10)/10; // to prevent rounding towards 60.0sec in the stream output
int gps_tow = trunc(gps_sec_one_digit_precicion); int gps_tow = trunc(gps_sec_one_digit_precicion);
double sub_sec = gps_sec_one_digit_precicion - double(gps_tow); double sub_sec = gps_sec_one_digit_precicion - double(gps_tow);
to_date_time(gps_week, gps_tow, year, month, day, hour, minute, second); to_date_time(gps_week, gps_tow, year, month, day, hour, minute, second);
line1 << asFixWidthString(year, 2, '0') << " " << asFixWidthString(month, 2, '0') << " " << asFixWidthString(day, 2, '0') << " " << asFixWidthString(hour, 2, '0') << " " << asFixWidthString(minute, 2, '0') << " " << rightJustify(asString(double(second)+sub_sec,1),4,' '); line1 << asFixWidthString(year, 2, '0') << " " << asFixWidthString(month, 2, '0') << " " << asFixWidthString(day, 2, '0') << " " << asFixWidthString(hour, 2, '0') << " " << asFixWidthString(minute, 2, '0') << " " << rightJustify(asString(double(second)+sub_sec,1),4,' ');
} }
else else
{ {
line1 << std::string(19, ' '); line1 << std::string(19, ' ');
} }
line1 << " "; line1 << " ";
// band // band
@ -4468,10 +4458,10 @@ void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_mes
// First 18 bytes of message (hex) // First 18 bytes of message (hex)
std::vector<unsigned char> msg = sbs_message.get_msg(); std::vector<unsigned char> msg = sbs_message.get_msg();
for (size_t i = 0; i < 18 && i < msg.size(); ++i) for (size_t i = 0; i < 18 && i < msg.size(); ++i)
{ {
line2 << std::hex << std::setfill('0') << std::setw(2); line2 << std::hex << std::setfill('0') << std::setw(2);
line2 << int(msg[i]) << " "; line2 << int(msg[i]) << " ";
} }
line2 << std::string(19, ' '); line2 << std::string(19, ' ');
lengthCheck(line2.str()); lengthCheck(line2.str());
out << line2.str() << std::endl; out << line2.str() << std::endl;
@ -4481,10 +4471,10 @@ void Rinex_Printer::log_rinex_sbs(std::fstream& out, const Sbas_Raw_Msg& sbs_mes
line3 << std::string(7, ' '); line3 << std::string(7, ' ');
// Remaining bytes of message (hex) // Remaining bytes of message (hex)
for (size_t i = 18; i < 36 && i < msg.size(); ++i) for (size_t i = 18; i < 36 && i < msg.size(); ++i)
{ {
line3 << std::hex << std::setfill('0') << std::setw(2); line3 << std::hex << std::setfill('0') << std::setw(2);
line3 << int(msg[i]) << " "; line3 << int(msg[i]) << " ";
} }
line3 << std::string(31, ' '); line3 << std::string(31, ' ');
lengthCheck(line3.str()); lengthCheck(line3.str());
out << line3.str() << std::endl; out << line3.str() << std::endl;
@ -4522,6 +4512,7 @@ boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_Ephemeris& ep
return p_time; return p_time;
} }
boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeris & eph, const double obs_time) boost::posix_time::ptime Rinex_Printer::compute_GPS_time(const Gps_CNAV_Ephemeris & eph, const double obs_time)
{ {
// The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here. // The RINEX v2.11 v3.00 format uses GPS time for the observations epoch, not UTC time, thus, no leap seconds needed here.