MCPcopy Create free account
hub / github.com/Xtra-Computing/thundersvm / getTimeDifference

Method getTimeDifference

src/thundersvm/util/log.cpp:1135–1146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133 }
1134
1135 unsigned long long DateTime::getTimeDifference(const struct timeval& endTime, const struct timeval& startTime,
1136 base::TimestampUnit timestampUnit) {
1137 if (timestampUnit == base::TimestampUnit::Microsecond) {
1138 return static_cast<unsigned long long>(static_cast<unsigned long long>(1000000 * endTime.tv_sec + endTime.tv_usec) -
1139 static_cast<unsigned long long>(1000000 * startTime.tv_sec + startTime.tv_usec));
1140 }
1141 // milliseconds
1142 auto conv = [](const struct timeval& tim) {
1143 return static_cast<unsigned long long>((tim.tv_sec * 1000) + (tim.tv_usec / 1000));
1144 };
1145 return static_cast<unsigned long long>(conv(endTime) - conv(startTime));
1146 }
1147
1148 struct ::tm* DateTime::buildTimeInfo(struct timeval* currTime, struct ::tm* timeInfo) {
1149#if ELPP_OS_UNIX

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected