diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2015-01-26 11:02:59 +0100 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-01-26 11:02:59 +0100 |
commit | 64c96a57b73397415eafa4ac2020ea7d99d7168c (patch) | |
tree | e71719d174d22aab6362858d383c292149ec8ae9 /include/linux/time.h | |
parent | e2e64a932556cdfae455497dbe94a8db151fc9fa (diff) | |
parent | 26bc420b59a38e4e6685a73345a0def461136dce (diff) |
Merge branch 'linus' into irq/core
Reason: Pull in upstream fixes on which new patches depend on.
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 203c2ad40d71..beebe3a02d43 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -110,6 +110,19 @@ static inline bool timespec_valid_strict(const struct timespec *ts) return true; } +static inline bool timeval_valid(const struct timeval *tv) +{ + /* Dates before 1970 are bogus */ + if (tv->tv_sec < 0) + return false; + + /* Can't have more microseconds then a second */ + if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC) + return false; + + return true; +} + extern struct timespec timespec_trunc(struct timespec t, unsigned gran); #define CURRENT_TIME (current_kernel_time()) |