diff options
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/pkt_sched.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index 75b5b9333fc7..1925c65e617b 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -169,17 +169,23 @@ psched_tod_diff(int delta_sec, int bound) | |||
169 | 169 | ||
170 | #define PSCHED_TADD2(tv, delta, tv_res) \ | 170 | #define PSCHED_TADD2(tv, delta, tv_res) \ |
171 | ({ \ | 171 | ({ \ |
172 | int __delta = (tv).tv_usec + (delta); \ | 172 | int __delta = (delta); \ |
173 | (tv_res).tv_sec = (tv).tv_sec; \ | 173 | (tv_res) = (tv); \ |
174 | if (__delta > USEC_PER_SEC) { (tv_res).tv_sec++; __delta -= USEC_PER_SEC; } \ | 174 | while(__delta >= USEC_PER_SEC){ \ |
175 | (tv_res).tv_sec++; \ | ||
176 | __delta -= USEC_PER_SEC; \ | ||
177 | } \ | ||
175 | (tv_res).tv_usec = __delta; \ | 178 | (tv_res).tv_usec = __delta; \ |
176 | }) | 179 | }) |
177 | 180 | ||
178 | #define PSCHED_TADD(tv, delta) \ | 181 | #define PSCHED_TADD(tv, delta) \ |
179 | ({ \ | 182 | ({ \ |
180 | (tv).tv_usec += (delta); \ | 183 | int __delta = (delta); \ |
181 | if ((tv).tv_usec > USEC_PER_SEC) { (tv).tv_sec++; \ | 184 | while(__delta >= USEC_PER_SEC){ \ |
182 | (tv).tv_usec -= USEC_PER_SEC; } \ | 185 | (tv).tv_sec++; \ |
186 | __delta -= USEC_PER_SEC; \ | ||
187 | } \ | ||
188 | (tv).tv_usec = __delta; \ | ||
183 | }) | 189 | }) |
184 | 190 | ||
185 | /* Set/check that time is in the "past perfect"; | 191 | /* Set/check that time is in the "past perfect"; |