diff options
| author | Rob Herring <robh@kernel.org> | 2015-02-04 10:43:01 -0600 |
|---|---|---|
| committer | Rob Herring <robh@kernel.org> | 2015-02-04 10:43:01 -0600 |
| commit | 962a70d05edac2e2eb53cd077715930083964b9e (patch) | |
| tree | f0b3a7bd574b2edfa76ce960e7f8630aea77e257 /include/linux/time.h | |
| parent | 10638a4ed2b8618f20fabf9ed19df60a68446e90 (diff) | |
| parent | 26bc420b59a38e4e6685a73345a0def461136dce (diff) | |
Merge tag 'v3.19-rc6' into HEAD
Linux 3.19-rc6
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()) |
