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:
parent
c4679ded38
commit
6937f2f12b
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue