diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-09-12 12:03:21 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-09-12 12:03:21 -0400 |
| commit | 97148ba2235e334e57d05fa07045cf3e6629763c (patch) | |
| tree | a04504e7d4feb0dacfe1862a59abecaf99997f09 /include/linux/ktime.h | |
| parent | 76ff3c6e3b389a5a7692811dd456e0ff58340cac (diff) | |
| parent | 05ff0e291af086f4325bac76abad250690bbbd63 (diff) | |
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 { | |||
| 56 | #endif | 56 | #endif |
| 57 | } ktime_t; | 57 | } ktime_t; |
| 58 | 58 | ||
| 59 | #define KTIME_MAX (~((u64)1 << 63)) | 59 | #define KTIME_MAX ((s64)~((u64)1 << 63)) |
| 60 | #define KTIME_SEC_MAX (KTIME_MAX / NSEC_PER_SEC) | ||
| 60 | 61 | ||
| 61 | /* | 62 | /* |
| 62 | * ktime_t definitions when using the 64-bit scalar representation: | 63 | * ktime_t definitions when using the 64-bit scalar representation: |
| @@ -73,6 +74,10 @@ typedef union { | |||
| 73 | */ | 74 | */ |
| 74 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) | 75 | static inline ktime_t ktime_set(const long secs, const unsigned long nsecs) |
| 75 | { | 76 | { |
| 77 | #if (BITS_PER_LONG == 64) | ||
| 78 | if (unlikely(secs >= KTIME_SEC_MAX)) | ||
| 79 | return (ktime_t){ .tv64 = KTIME_MAX }; | ||
| 80 | #endif | ||
| 76 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; | 81 | return (ktime_t) { .tv64 = (s64)secs * NSEC_PER_SEC + (s64)nsecs }; |
| 77 | } | 82 | } |
| 78 | 83 | ||
