\brief re-unit the time \param time the time \return the re-unit time
| 132 | /// \param time the time |
| 133 | /// \return the re-unit time |
| 134 | inline time_with_unit re_unit(time_with_unit time){ |
| 135 | time = cast_to_us(time); |
| 136 | float time_us = time.first; |
| 137 | std::string time_unit = time.second; |
| 138 | if (time_us > 1000000){ |
| 139 | time_us /= 1000000; |
| 140 | time_unit = "s"; |
| 141 | } |
| 142 | else if (time_us > 1000){ |
| 143 | time_us /= 1000; |
| 144 | time_unit = "ms"; |
| 145 | } |
| 146 | return std::make_pair(time_us, time_unit); |
| 147 | } |
| 148 | |
| 149 | } // end of namespace time_utils |
| 150 |
no test coverage detected