Merge pull request #3579 from clayton-shopify/fix-time-alloc-usec

Correctly handle large negative usec value.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-04-04 11:17:10 +09:00
committed by GitHub
+1 -1
View File
@@ -245,7 +245,7 @@ time_alloc(mrb_state *mrb, double sec, double usec, enum mrb_timezone timezone)
tm->usec -= sec2 * 1000000;
tm->sec += sec2;
}
if (tm->usec >= 1000000) {
else if (tm->usec >= 1000000) {
long sec2 = usec / 1000000;
tm->usec -= sec2 * 1000000;
tm->sec += sec2;