MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / bytes_per_second_to_string

Method bytes_per_second_to_string

OpenHD/ohd_common/src/openhd_bitrate.cpp:69–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67}
68
69std::string openhd::bytes_per_second_to_string(double bytes_per_second) {
70 const auto bits_per_second = bytes_per_second * 8;
71 std::stringstream ss;
72 ss.precision(2);
73 if (bits_per_second > 1000 * 1000) {
74 const auto mBits_per_second =
75 static_cast<double>(bits_per_second) / (1000.0 * 1000.0);
76 ss << mBits_per_second << "mBit/s";
77 return ss.str();
78 }
79 const auto kBits_per_second = static_cast<double>(bits_per_second) / 1000;
80 ss << kBits_per_second << "kBit/s";
81 return ss.str();
82}
83
84std::string openhd::pps_to_string(double pps) {
85 std::stringstream ss;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected