aboutsummaryrefslogtreecommitdiff
path: root/include/linux/time.h
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-02-02 11:29:07 +0000
committerMark Brown <broonie@kernel.org>2015-02-02 11:29:07 +0000
commit692d96aa22dea8bb80018c6a76556ad6afd464a6 (patch)
treee8dd55655fa001e53058c5264d541f8b3d3c1a7b /include/linux/time.h
parent1874098820e8269fe88d67bc08c908134dd87102 (diff)
parent4227cffc1f9e4a9241071354476c225705b614c8 (diff)
Merge tag 'v3.10.67' into linux-linaro-lsk
This is the 3.10.67 stable release
Diffstat (limited to 'include/linux/time.h')
-rw-r--r--include/linux/time.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/time.h b/include/linux/time.h
index d5d229b2e5af..7d532a32ff3a 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -173,6 +173,19 @@ extern void getboottime(struct timespec *ts);
extern void monotonic_to_bootbased(struct timespec *ts);
extern void get_monotonic_boottime(struct timespec *ts);
+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);
extern int timekeeping_valid_for_hres(void);
extern u64 timekeeping_max_deferment(void);