From 6937f2f12bf6fd015f2f9ace8ea1086a5f4d0071 Mon Sep 17 00:00:00 2001 From: Laurence Withers Date: Thu, 12 Feb 2009 02:31:04 +0000 Subject: [PATCH] Bugfix in rounding of iso8601_add_elapsed() When adding a number of nanoseconds so that the resultant date lies exactly on a second boundary, rounding was not performed when it should have been. Fix the rounding so that the seconds field rolls over. --- src/libiso8601/400_manip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libiso8601/400_manip.c b/src/libiso8601/400_manip.c index f66c131..f766b18 100644 --- a/src/libiso8601/400_manip.c +++ b/src/libiso8601/400_manip.c @@ -50,7 +50,7 @@ void iso8601_add_elapsed(struct iso8601_date* date, const struct iso8601_elapsed date->sec += qr.rem - leapcorrect; date->nsec += per->nsec; - if(date->nsec > BILLION) { + if(date->nsec >= BILLION) { ++date->sec; date->nsec -= BILLION; }