From 9fe35d997b559293c356425ef3063b07e3fddb5d Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 6 Sep 2006 00:03:42 -0700 Subject: [PATCH] --- yaml --- r: 33800 b: refs/heads/master c: 96dd7421a06a5bc6eb731323b95efcb2fd864854 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/ktime.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 7fa699010609..e7b5f6f578bd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: fe2bbc4832659b7ffc867cac03e0a92ae81e11e4 +refs/heads/master: 96dd7421a06a5bc6eb731323b95efcb2fd864854 diff --git a/trunk/include/linux/ktime.h b/trunk/include/linux/ktime.h index ed3396dcc4f7..84eeecd60a02 100644 --- a/trunk/include/linux/ktime.h +++ b/trunk/include/linux/ktime.h @@ -56,7 +56,8 @@ typedef union { #endif } ktime_t; -#define KTIME_MAX (~((u64)1 << 63)) +#define KTIME_MAX ((s64)~((u64)1 << 63)) +#define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) /* * ktime_t definitions when using the 64-bit scalar representation: @@ -73,6 +74,10 @@ typedef union { */ static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) { +#if (BITS_PER_LONG == 64) + if (unlikely(secs >= KTIME_SEC_MAX)) + return (ktime_t){ .tv64 = KTIME_MAX }; +#endif return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; }