Rev 3031 | Rev 4065 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3031 | Rev 3482 | ||
---|---|---|---|
Line 300... | Line 300... | ||
300 | extern u64 jiffies_64_to_clock_t(u64 x); |
300 | extern u64 jiffies_64_to_clock_t(u64 x); |
301 | extern u64 nsec_to_clock_t(u64 x); |
301 | extern u64 nsec_to_clock_t(u64 x); |
302 | extern u64 nsecs_to_jiffies64(u64 n); |
302 | extern u64 nsecs_to_jiffies64(u64 n); |
303 | extern unsigned long nsecs_to_jiffies(u64 n); |
303 | extern unsigned long nsecs_to_jiffies(u64 n); |
Line -... | Line 304... | ||
- | 304 | ||
- | 305 | ||
- | 306 | static unsigned long round_jiffies_common(unsigned long j, bool force_up) |
|
- | 307 | { |
|
- | 308 | int rem; |
|
- | 309 | unsigned long original = j; |
|
- | 310 | ||
- | 311 | rem = j % HZ; |
|
- | 312 | ||
- | 313 | /* |
|
- | 314 | * If the target jiffie is just after a whole second (which can happen |
|
- | 315 | * due to delays of the timer irq, long irq off times etc etc) then |
|
- | 316 | * we should round down to the whole second, not up. Use 1/4th second |
|
- | 317 | * as cutoff for this rounding as an extreme upper bound for this. |
|
- | 318 | * But never round down if @force_up is set. |
|
- | 319 | */ |
|
- | 320 | if (rem < HZ/4 && !force_up) /* round down */ |
|
- | 321 | j = j - rem; |
|
- | 322 | else /* round up */ |
|
- | 323 | j = j - rem + HZ; |
|
- | 324 | ||
- | 325 | if (j <= GetTimerTicks()) /* rounding ate our timeout entirely; */ |
|
- | 326 | return original; |
|
- | 327 | return j; |
|
- | 328 | } |
|
- | 329 | ||
- | 330 | ||
- | 331 | ||
- | 332 | unsigned long round_jiffies_up_relative(unsigned long j); |
|
304 | 333 | ||
Line 305... | Line 334... | ||
305 | #define TIMESTAMP_SIZE 30 |
334 | #define TIMESTAMP_SIZE 30 |