add makeHexDump function for easier debugging

pull/96/head
bert hubert 2020-02-05 13:54:26 +01:00
parent bad00b4266
commit cbc91a2f58
2 changed files with 15 additions and 0 deletions

View File

@ -294,3 +294,16 @@ double utcFromGPS(int wn, double tow)
{
return (315964800 + wn * 7*86400 + tow - g_dtLS);
}
string makeHexDump(const string& str)
{
char tmp[5];
string ret;
ret.reserve((int)(str.size()*2.2));
for(string::size_type n=0;n<str.size();++n) {
snprintf(tmp, sizeof(tmp), "%02x ", (unsigned char)str[n]);
ret+=tmp;
}
return ret;
}

View File

@ -70,3 +70,5 @@ extern int g_dtLS, g_dtLSBeidou;
uint64_t utcFromGST(int wn, int tow);
double utcFromGST(int wn, double tow);
double utcFromGPS(int wn, double tow);
std::string makeHexDump(const std::string& str);