| 1115 | } |
| 1116 | |
| 1117 | base::type::string_t DateTime::formatTime(unsigned long long time, base::TimestampUnit timestampUnit) { |
| 1118 | base::type::EnumType start = static_cast<base::type::EnumType>(timestampUnit); |
| 1119 | const base::type::char_t* unit = base::consts::kTimeFormats[start].unit; |
| 1120 | for (base::type::EnumType i = start; i < base::consts::kTimeFormatsCount - 1; ++i) { |
| 1121 | if (time <= base::consts::kTimeFormats[i].value) { |
| 1122 | break; |
| 1123 | } |
| 1124 | if (base::consts::kTimeFormats[i].value == 1000.0f && time / 1000.0f < 1.9f) { |
| 1125 | break; |
| 1126 | } |
| 1127 | time /= static_cast<decltype(time)>(base::consts::kTimeFormats[i].value); |
| 1128 | unit = base::consts::kTimeFormats[i + 1].unit; |
| 1129 | } |
| 1130 | base::type::stringstream_t ss; |
| 1131 | ss << time << " " << unit; |
| 1132 | return ss.str(); |
| 1133 | } |
| 1134 | |
| 1135 | unsigned long long DateTime::getTimeDifference(const struct timeval& endTime, const struct timeval& startTime, |
| 1136 | base::TimestampUnit timestampUnit) { |
nothing calls this directly
no outgoing calls
no test coverage detected