public inbox for linux-rt-users@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cyclictest: calcdiff calculated wrong seconds if the difference was bigger than 2147s
@ 2009-05-27 21:22 Stefan Agner
       [not found] ` <826434.45900.qm@web59805.mail.ac4.yahoo.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2009-05-27 21:22 UTC (permalink / raw)
  To: linux-rt-users

[-- Attachment #1: Type: text/plain, Size: 1042 bytes --]


Signed-off-by: Stefan Agner <stefan@agner.ch>
---
 src/cyclictest/cyclictest.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index be9a3f9..6d695cb 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -290,7 +290,7 @@ static inline void tsnorm(struct timespec *ts)
 static inline long calcdiff(struct timespec t1, struct timespec t2)
 {
 	long diff;
-	diff = USEC_PER_SEC * ((int) t1.tv_sec - (int) t2.tv_sec);
+	diff = USEC_PER_SEC * (long)((int) t1.tv_sec - (int) t2.tv_sec);
 	diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000;
 	return diff;
 }
@@ -298,7 +298,7 @@ static inline long calcdiff(struct timespec t1, struct timespec t2)
 static inline long calcdiff_ns(struct timespec t1, struct timespec t2)
 {
 	long diff;
-	diff = NSEC_PER_SEC * ((int) t1.tv_sec - (int) t2.tv_sec);
+	diff = NSEC_PER_SEC * (long)((int) t1.tv_sec - (int) t2.tv_sec);
 	diff += ((int) t1.tv_nsec - (int) t2.tv_nsec);
 	return diff;
 }
-- 


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 3928 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-28 19:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-27 21:22 [PATCH] cyclictest: calcdiff calculated wrong seconds if the difference was bigger than 2147s Stefan Agner
     [not found] ` <826434.45900.qm@web59805.mail.ac4.yahoo.com>
2009-05-27 21:53   ` [PATCH RESEND] " Stefan Agner
2009-05-28 19:52     ` Clark Williams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox