diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-20 22:54:53 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-20 22:54:53 +0300 |
commit | 4c971aa78314253cce914ed29e3d90df3326d646 (patch) | |
tree | a9dcf0b1fdc9e1aacff90afb5b3ab79983115dcc /include/linux/time.h | |
parent | 4ba24fef3eb3b142197135223b90ced2f319cd53 (diff) | |
parent | 290b799c390d77d27effee3ce312203aaa32ee74 (diff) | |
download | linux-4c971aa78314253cce914ed29e3d90df3326d646.tar.xz |
Merge branch 'next' into for-linus
Second round of updates for 3.20.
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()) |