libqb/0001-UTIL-fix-qb_timespec_add_ms.patch
Angus Salkeld 9bd8c740ca fix qb_timespec_add_ms()
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
2012-01-10 20:23:55 +11:00

32 lines
856 B
Diff

From ef64fd1186979bae8eee2babb04d9b5b29d3099b Mon Sep 17 00:00:00 2001
From: Angus Salkeld <asalkeld@redhat.com>
Date: Mon, 9 Jan 2012 10:24:08 +1100
Subject: [PATCH] UTIL: fix qb_timespec_add_ms()
It was overwriting the timespec value instead of
add to it.
Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
---
lib/util.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/util.c b/lib/util.c
index 51c94bb..6b835cc 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -126,8 +126,8 @@ void
qb_timespec_add_ms(struct timespec *ts, int32_t ms)
{
#ifndef S_SPLINT_S
- ts->tv_sec = ms / 1000;
- ts->tv_nsec = (ms % 1000) * QB_TIME_NS_IN_MSEC;
+ ts->tv_sec += ms / 1000;
+ ts->tv_nsec += (ms % 1000) * QB_TIME_NS_IN_MSEC;
if (ts->tv_nsec >= 1000000000L) {
ts->tv_sec++;
ts->tv_nsec = ts->tv_nsec - 1000000000L;
--
1.7.7.5