X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Ftime.h;h=2111941c1af7ed3fa122e127f894ad0e40d56571;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=d24a690cbd04dabbe813984b0e613bc92a3df54c;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/include/linux/time.h b/include/linux/time.h index d24a690cb..2111941c1 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -194,8 +194,22 @@ static inline unsigned int jiffies_to_msecs(const unsigned long j) return (j * 1000) / HZ; #endif } + +static inline unsigned int jiffies_to_usecs(const unsigned long j) +{ +#if HZ <= 1000 && !(1000 % HZ) + return (1000000 / HZ) * j; +#elif HZ > 1000 && !(HZ % 1000) + return (j*1000 + (HZ - 1000))/(HZ / 1000); +#else + return (j * 1000000) / HZ; +#endif +} + static inline unsigned long msecs_to_jiffies(const unsigned int m) { + if (m > jiffies_to_msecs(MAX_JIFFY_OFFSET)) + return MAX_JIFFY_OFFSET; #if HZ <= 1000 && !(1000 % HZ) return (m + (1000 / HZ) - 1) / (1000 / HZ); #elif HZ > 1000 && !(HZ % 1000) @@ -348,6 +362,7 @@ extern long do_utimes(char __user * filename, struct timeval * times); struct itimerval; extern int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue); extern int do_getitimer(int which, struct itimerval *value); +extern void getnstimeofday (struct timespec *tv); static inline void set_normalized_timespec (struct timespec *ts, time_t sec, long nsec)