X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-kernel.git;a=blobdiff_plain;f=include%2Flinux%2Ftime.h;h=a87b4403600ff6cd540dd1a76f2f7ad9b8e582a5;hp=8c0216e7d30231e79fc45f0581ebc7f88f6fa3fb;hb=1751fde0bb621f9d05dc76c7a0045b70b88918c2;hpb=ee368a2c5ed1806a6cbdcddadac86cbb3816d2f5 diff --git a/include/linux/time.h b/include/linux/time.h index 8c0216e7d302..a87b4403600f 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -138,6 +138,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 void read_persistent_clock(struct timespec *ts); extern void read_boot_clock(struct timespec *ts); extern int update_persistent_clock(struct timespec now);