aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-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 8c42cf8d2444..5989b0ead1ec 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -99,6 +99,19 @@ static inline bool timespec_valid_strict(const struct timespec *ts)
99 return true; 99 return true;
100} 100}
101 101
102static inline bool timeval_valid(const struct timeval *tv)
103{
104 /* Dates before 1970 are bogus */
105 if (tv->tv_sec < 0)
106 return false;
107
108 /* Can't have more microseconds then a second */
109 if (tv->tv_usec < 0 || tv->tv_usec >= USEC_PER_SEC)
110 return false;
111
112 return true;
113}
114
102extern struct timespec timespec_trunc(struct timespec t, unsigned gran); 115extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
103 116
104#define CURRENT_TIME (current_kernel_time()) 117#define CURRENT_TIME (current_kernel_time())