summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stone <daniels@collabora.com>2017-03-01 11:34:01 +0000
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2017-03-08 11:57:34 +0200
commit61f6d7d372f600de36412a41269909050978bcd6 (patch)
treea61e361f79012582cabb9db141a45bdff9bfa029 /tests
parent5ae7e84c6bc37436e636b75e53788f478ef78454 (diff)
timespec: Add timespec_add_msec helper
Add a (timespec) = (timespec) + (msec) helper, to save intermediate conversions in its users. Signed-off-by: Daniel Stone <daniels@collabora.com> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'tests')
-rw-r--r--tests/timespec-test.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/timespec-test.c b/tests/timespec-test.c
index 91d53f73..cd3b1c1a 100644
--- a/tests/timespec-test.c
+++ b/tests/timespec-test.c
@@ -122,3 +122,14 @@ ZUC_TEST(timespec_test, timespec_add_nsec)
ZUC_ASSERT_EQ(16, r.tv_sec);
ZUC_ASSERT_EQ(0, r.tv_nsec);
}
+
+ZUC_TEST(timespec_test, timespec_add_msec)
+{
+ struct timespec a, r;
+
+ a.tv_sec = 1000;
+ a.tv_nsec = 1;
+ timespec_add_msec(&r, &a, 2002);
+ ZUC_ASSERT_EQ(1002, r.tv_sec);
+ ZUC_ASSERT_EQ(2000001, r.tv_nsec);
+}