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.
This commit is contained in:
Laurence Withers 2009-02-12 02:31:04 +00:00
parent c4679ded38
commit 6937f2f12b
1 changed files with 1 additions and 1 deletions

View File

@ -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;
}