diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-09-11 17:05:33 +0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-09-11 17:05:33 +0400 |
| commit | 10e299fc6d596f4e8476d24ebba1495a8355baff (patch) | |
| tree | f7517eccba4dfc223113961c64429f3986afa8eb /include/linux/ktime.h | |
| parent | cff93eb3d3244cc117a5204fe1d62102b506afb9 (diff) | |
| parent | 38f5745c5a90641079fd5b48600ae63f7ab6edcd (diff) | |
| download | linux-10e299fc6d596f4e8476d24ebba1495a8355baff.tar.xz | |
Merge branch 'master' into upstream
Diffstat (limited to 'include/linux/ktime.h')
| -rw-r--r-- | include/linux/ktime.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index ed3396dcc4f7..84eeecd60a02 100644 --- a/include/linux/ktime.h +++ b/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 }; } |
