Skip to content

Commit

Permalink
[PKT_SCHED]: PSCHED_TADD() and PSCHED_TADD2() can result,tv_usec >= 1…
Browse files Browse the repository at this point in the history
…000000

Signed-off-by: Shuya MAEDA <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Shuya MAEDA authored and David S. Miller committed Jun 29, 2006
1 parent 3d3a853 commit 4ee303d
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions include/net/pkt_sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,23 @@ psched_tod_diff(int delta_sec, int bound)

#define PSCHED_TADD2(tv, delta, tv_res) \
({ \
int __delta = (tv).tv_usec + (delta); \
(tv_res).tv_sec = (tv).tv_sec; \
if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \
int __delta = (delta); \
(tv_res) = (tv); \
while(__delta >= USEC_PER_SEC){ \
(tv_res).tv_sec++; \
__delta -= USEC_PER_SEC; \
} \
(tv_res).tv_usec = __delta; \
})

#define PSCHED_TADD(tv, delta) \
({ \
(tv).tv_usec += (delta); \
if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \
(tv).tv_usec -= USEC_PER_SEC; } \
int __delta = (delta); \
while(__delta >= USEC_PER_SEC){ \
(tv).tv_sec++; \
__delta -= USEC_PER_SEC; \
} \
(tv).tv_usec = __delta; \
})

/* Set/check that time is in the "past perfect";
Expand Down

0 comments on commit 4ee303d

Please sign in to comment.