diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2006-02-13 00:13:48 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-02-13 00:13:48 -0500 |
commit | 3875e1945b55f0eb83fe7359614a801eeb716761 (patch) | |
tree | 4567aef3fb7d081cb7d7b7c9bcd94e0e44d39557 /include/linux/time.h | |
parent | 587005de144acd3007b8e7f2a2a7c6add157c155 (diff) | |
parent | f1b318793dcd2d9ff6b5ac06e7762098fa079cee (diff) | |
download | op-kernel-dev-3875e1945b55f0eb83fe7359614a801eeb716761.zip op-kernel-dev-3875e1945b55f0eb83fe7359614a801eeb716761.tar.gz |
Merge branch 'upstream'
Diffstat (limited to 'include/linux/time.h')
-rw-r--r-- | include/linux/time.h | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/include/linux/time.h b/include/linux/time.h index 7b4dc365..d9cdba5 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -33,11 +33,34 @@ struct timezone { #define NSEC_PER_SEC 1000000000L #define NSEC_PER_USEC 1000L -static __inline__ int timespec_equal(struct timespec *a, struct timespec *b) +static inline int timespec_equal(struct timespec *a, struct timespec *b) { return (a->tv_sec == b->tv_sec) && (a->tv_nsec == b->tv_nsec); } +/* + * lhs < rhs: return <0 + * lhs == rhs: return 0 + * lhs > rhs: return >0 + */ +static inline int timespec_compare(struct timespec *lhs, struct timespec *rhs) +{ + if (lhs->tv_sec < rhs->tv_sec) + return -1; + if (lhs->tv_sec > rhs->tv_sec) + return 1; + return lhs->tv_nsec - rhs->tv_nsec; +} + +static inline int timeval_compare(struct timeval *lhs, struct timeval *rhs) +{ + if (lhs->tv_sec < rhs->tv_sec) + return -1; + if (lhs->tv_sec > rhs->tv_sec) + return 1; + return lhs->tv_usec - rhs->tv_usec; +} + extern unsigned long mktime(const unsigned int year, const unsigned int mon, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec); |