* [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
* Re: [PATCH RESEND] cyclictest: calcdiff calculated wrong seconds if the difference was bigger than 2147s
[not found] ` <826434.45900.qm@web59805.mail.ac4.yahoo.com>
@ 2009-05-27 21:53 ` Stefan Agner
2009-05-28 19:52 ` Clark Williams
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Agner @ 2009-05-27 21:53 UTC (permalink / raw)
To: linux-rt-users
Hello,
My first fix didn't took into account that long is 4 byte long on ARM. Therefor
I changed it to long long now, which works on my ARM board...
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
src/cyclictest/cyclictest.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index be9a3f9..3035a0a 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -287,18 +287,18 @@ static inline void tsnorm(struct timespec *ts)
}
}
-static inline long calcdiff(struct timespec t1, struct timespec t2)
+static inline long long calcdiff(struct timespec t1, struct timespec t2)
{
- long diff;
- diff = USEC_PER_SEC * ((int) t1.tv_sec - (int) t2.tv_sec);
+ long long diff;
+ diff = USEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
diff += ((int) t1.tv_nsec - (int) t2.tv_nsec) / 1000;
return diff;
}
-static inline long calcdiff_ns(struct timespec t1, struct timespec t2)
+static inline long long calcdiff_ns(struct timespec t1, struct timespec t2)
{
- long diff;
- diff = NSEC_PER_SEC * ((int) t1.tv_sec - (int) t2.tv_sec);
+ long long diff;
+ diff = NSEC_PER_SEC * (long long)((int) t1.tv_sec - (int) t2.tv_sec);
diff += ((int) t1.tv_nsec - (int) t2.tv_nsec);
return diff;
}
-- 1.6.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH RESEND] cyclictest: calcdiff calculated wrong seconds if the difference was bigger than 2147s
2009-05-27 21:53 ` [PATCH RESEND] " Stefan Agner
@ 2009-05-28 19:52 ` Clark Williams
0 siblings, 0 replies; 3+ messages in thread
From: Clark Williams @ 2009-05-28 19:52 UTC (permalink / raw)
To: Stefan Agner; +Cc: linux-rt-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wed, 27 May 2009 23:53:07 +0200
Stefan Agner <stefan@agner.ch> wrote:
> Hello,
>
> My first fix didn't took into account that long is 4 byte long on ARM. Therefor
> I changed it to long long now, which works on my ARM board...
>
>
Thanks Stefan, applied.
Clark
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.10 (GNU/Linux)
iEYEARECAAYFAkoe63cACgkQHyuj/+TTEp0T8ACfTMRPJYfY3gb+RKZ4iWKMHytV
qDUAoNhorhydnzIOD8TfDoNYyQA2McVl
=LXAh
-----END PGP SIGNATURE-----
^ permalink raw reply [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;
as well as URLs for NNTP newsgroup(s).