lib: Fix clock_gettime linking problems.

Until glibc 2.17 clock_* calls needed explicit -lrt and hence linking
with -lltp fails on older distributions.

Since we do not want to link whole LTP with -lrt this commit adds simple
internal functions for clock_gettime() and clock_getres() calls to be
used internally in the test library.

Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
Acked-by: Jan Stancek <jstancek@redhat.com>
diff --git a/lib/tst_timer.c b/lib/tst_timer.c
index bd3f277..afdb441 100644
--- a/lib/tst_timer.c
+++ b/lib/tst_timer.c
@@ -25,6 +25,7 @@
 
 #include "test.h"
 #include "tst_timer.h"
+#include "tst_clocks.h"
 #include "lapi/posix_clocks.h"
 
 static struct timespec start_time, stop_time;
@@ -56,7 +57,7 @@
 
 void tst_timer_check(clockid_t clk_id)
 {
-	if (clock_gettime(clk_id, &start_time)) {
+	if (tst_clock_gettime(clk_id, &start_time)) {
 		if (errno == EINVAL) {
 			tst_brkm(TCONF, NULL,
 			         "Clock id %s(%u) not supported by kernel",
@@ -64,7 +65,7 @@
 			return;
 		}
 
-		tst_brkm(TBROK | TERRNO, NULL, "clock_gettime() failed");
+		tst_brkm(TBROK | TERRNO, NULL, "tst_clock_gettime() failed");
 	}
 }
 
@@ -72,14 +73,14 @@
 {
 	clock_id = clk_id;
 
-	if (clock_gettime(clock_id, &start_time))
-		tst_resm(TWARN | TERRNO, "clock_gettime() failed");
+	if (tst_clock_gettime(clock_id, &start_time))
+		tst_resm(TWARN | TERRNO, "tst_clock_gettime() failed");
 }
 
 void tst_timer_stop(void)
 {
-	if (clock_gettime(clock_id, &stop_time))
-		tst_resm(TWARN | TERRNO, "clock_gettime() failed");
+	if (tst_clock_gettime(clock_id, &stop_time))
+		tst_resm(TWARN | TERRNO, "tst_clock_gettime() failed");
 }
 
 struct timespec tst_timer_elapsed(void)