KVM: selftests: Rework timespec functions and usage

The steal_time test's timespec stop condition was wrong and should have
used the timespec functions instead to avoid being wrong, but
timespec_diff had a strange interface. Rework all the timespec API and
its use.

Signed-off-by: Andrew Jones <drjones@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Andrew Jones
2020-03-16 18:37:03 +01:00
committed by Paolo Bonzini
parent cf6c26ec7b
commit bfcaa84975
4 changed files with 35 additions and 44 deletions

View File

@@ -61,7 +61,8 @@ void test_assert(bool exp, const char *exp_str,
size_t parse_size(const char *size);
int64_t timespec_to_ns(struct timespec ts);
struct timespec timespec_diff(struct timespec start, struct timespec end);
struct timespec timespec_add_ns(struct timespec ts, int64_t ns);
struct timespec timespec_add(struct timespec ts1, struct timespec ts2);
struct timespec timespec_sub(struct timespec ts1, struct timespec ts2);
#endif /* SELFTEST_KVM_TEST_UTIL_H */