\brief cast to microseconds \param time the time \return the time in microseconds
| 69 | /// \param time the time |
| 70 | /// \return the time in microseconds |
| 71 | inline time_with_unit cast_to_us(time_with_unit time){ |
| 72 | if (time.second == "ns"){ |
| 73 | return std::make_pair(time.first / 1000, "us"); |
| 74 | } |
| 75 | if (time.second == "us"){ |
| 76 | return time; |
| 77 | } |
| 78 | if (time.second == "ms"){ |
| 79 | return std::make_pair(time.first * 1000, "us"); |
| 80 | } |
| 81 | if (time.second == "s"){ |
| 82 | return std::make_pair(time.first * 1000000, "us"); |
| 83 | } |
| 84 | else{ |
| 85 | return time; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /// \brief cast to milliseconds |
| 90 | /// \param time the time |
no outgoing calls
no test coverage detected