[3/3] test: explicitly cast time types to types printf can handle
diff mbox series

Message ID 202001232032.00NKWWwd018015@herc.mirbsd.org
State New
Headers show
Series
  • [1/3] pcm: ensure amd64-specific asm code is not used on x32
Related show

Commit Message

mirabilos Jan. 23, 2020, 8:21 p.m. UTC
Also (as requested by Takashi Iwai), convert timediff() to time_t,
as it’s the proper return type.

Signed-off-by: mirabilos <tg@debian.org>
---
 test/latency.c     | 10 +++++-----
 test/queue_timer.c | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

Patch
diff mbox series

diff --git a/test/latency.c b/test/latency.c
index 298bab8a..cf39d319 100644
--- a/test/latency.c
+++ b/test/latency.c
@@ -325,7 +325,7 @@  void setscheduler(void)
 	printf("!!!Scheduler set to Round Robin with priority %i FAILED!!!\n", sched_param.sched_priority);
 }
 
-long timediff(snd_timestamp_t t1, snd_timestamp_t t2)
+time_t timediff(snd_timestamp_t t1, snd_timestamp_t t2)
 {
 	signed long l;
 
@@ -683,12 +683,12 @@  int main(int argc, char *argv[])
 		snd_pcm_nonblock(phandle, !block ? 1 : 0);
 		if (ok) {
 #if 1
-			printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
-			       p_tstamp.tv_sec,
+			printf("Playback time = %lli.%i, Record time = %lli.%i, diff = %lli\n",
+			       (long long)p_tstamp.tv_sec,
 			       (int)p_tstamp.tv_usec,
-			       c_tstamp.tv_sec,
+			       (long long)c_tstamp.tv_sec,
 			       (int)c_tstamp.tv_usec,
-			       timediff(p_tstamp, c_tstamp));
+			       (long long)timediff(p_tstamp, c_tstamp));
 #endif
 			break;
 		}
diff --git a/test/queue_timer.c b/test/queue_timer.c
index c4ffb192..c5ce5866 100644
--- a/test/queue_timer.c
+++ b/test/queue_timer.c
@@ -99,11 +99,11 @@  main(int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
 	normalize(&diffdiff);
 	prevdiff = diff;
 
-	fprintf(stderr, " real time: %12ld sec %8ld usec\nqueue time: %12ld sec %8ld usec\n      diff: %12ld sec %8ld usec\n  diffdiff: %12ld sec %8ld usec\n",
-		tv.tv_sec, tv.tv_usec,
-		(long)rtime->tv_sec, (long)rtime->tv_nsec / 1000,
-		diff.tv_sec, diff.tv_usec,
-		(long)diffdiff.tv_sec, (long)diffdiff.tv_usec);
+	fprintf(stderr, " real time: %12lld sec %8ld usec\nqueue time: %12lld sec %8ld usec\n      diff: %12lld sec %8ld usec\n  diffdiff: %12lld sec %8ld usec\n",
+		(long long)tv.tv_sec, (long)tv.tv_usec,
+		(long long)rtime->tv_sec, (long)rtime->tv_nsec / 1000,
+		(long long)diff.tv_sec, (long)diff.tv_usec,
+		(long long)diffdiff.tv_sec, (long)diffdiff.tv_usec);
 
 	if (diffdiff.tv_usec >  5000 ||
 	    diffdiff.tv_usec < -5000) {