summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2017-03-01 11:34:02 +0000
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-03-13 14:19:46 +0200
commit37ad7e3bae090c8791dc638bfc3f952fb5c12acf (patch)
treeb22f4bd40e2c415d054e31f25dc530ef8ef8053c /tests
parent61f6d7d372f600de36412a41269909050978bcd6 (diff)
timespec: Add timespec_to_msec helper
Paralleling timespec_to_nsec, converts to milliseconds. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> [Pekka: added doc about flooring] Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/timespec-test.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/timespec-test.c b/tests/timespec-test.c
index cd3b1c1a..712d1acd 100644
--- a/tests/timespec-test.c
+++ b/tests/timespec-test.c
@@ -60,6 +60,15 @@ ZUC_TEST(timespec_test, timespec_to_nsec)
ZUC_ASSERT_EQ(timespec_to_nsec(&a), (NSEC_PER_SEC * 4ULL) + 4);
}
+ZUC_TEST(timespec_test, timespec_to_msec)
+{
+ struct timespec a;
+
+ a.tv_sec = 4;
+ a.tv_nsec = 4000000;
+ ZUC_ASSERT_EQ(timespec_to_msec(&a), (4000ULL) + 4);
+}
+
ZUC_TEST(timespec_test, millihz_to_nsec)
{
ZUC_ASSERT_EQ(millihz_to_nsec(60000), 16666666);